This is a tracking issues of queries appearing slow on Zeus. We should keep an eye on them and check if there is anything we can do to improve how long they take to execute.
For some queries that might adding a missing index, batching or an architectural overhaul.
indexd-1 | 2026-03-20T13:32:30Z DEBUG postgres.transaction slow exec {"id": "3ee49935", "attempt": 1, "query": "UPDATE contracts SET good = FALSE WHERE proof_height <= $1", "elapsed": "1.011385703s", "stack": "go.sia.tech/indexd/persist/postgres.(*txn).Exec\n\tgo.sia.tech/indexd/persist/postgres/sql.go:76\ngo.sia.tech/indexd/persist/postgres.(*Store).MarkUnrenewableContractsBad.func1\n\tgo.sia.tech/indexd/persist/postgres/contracts.go:708\ngo.sia.tech/indexd/persist/postgres.(*Store).doTransaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:112\ngo.sia.tech/indexd/persist/postgres.(*Store).transaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:64\ngo.sia.tech/indexd/persist/postgres.(*Store).MarkUnrenewableContractsBad\n\tgo.sia.tech/indexd/persist/postgres/contracts.go:707\ngo.sia.tech/indexd/contracts.(*ContractManager).performContractMaintenance\n\tgo.sia.tech/indexd/contracts/maintenance.go:80\ngo.sia.tech/indexd/contracts.(*ContractManager).maintenanceLoop.func2\n\tgo.sia.tech/indexd/contracts/maintenance.go:145\nsync.(*WaitGroup).Go.func1\n\tsync/waitgroup.go:258"}
indexd-1 | 2026-03-20T13:32:35Z DEBUG postgres.transaction slow exec {"id": "0a5edbb1", "attempt": 1, "query": "\n\t\t\t\tUPDATE sectors\n\t\t\t\tSET next_integrity_check = $1, consecutive_failed_checks = 0\n\t\t\t\tWHERE host_id = (SELECT id FROM hosts WHERE public_key = $2) AND\n\t\t\t\t\tsector_root = ANY($3)\n\t\t\t", "elapsed": "387.652138ms", "stack": "go.sia.tech/indexd/persist/postgres.(*txn).Exec\n\tgo.sia.tech/indexd/persist/postgres/sql.go:76\ngo.sia.tech/indexd/persist/postgres.(*Store).RecordIntegrityCheck.func1\n\tgo.sia.tech/indexd/persist/postgres/sectors.go:92\ngo.sia.tech/indexd/persist/postgres.(*Store).doTransaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:112\ngo.sia.tech/indexd/persist/postgres.(*Store).transaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:64\ngo.sia.tech/indexd/persist/postgres.(*Store).RecordIntegrityCheck\n\tgo.sia.tech/indexd/persist/postgres/sectors.go:85\ngo.sia.tech/indexd/slabs.(*SlabManager).performIntegrityChecksForHost.func1\n\tgo.sia.tech/indexd/slabs/dataintegrity.go:92\ngo.sia.tech/indexd/slabs.(*SlabManager).performIntegrityChecksForHost\n\tgo.sia.tech/indexd/slabs/dataintegrity.go:105\ngo.sia.tech/indexd/slabs.(*SlabManager).performIntegrityChecks.func1\n\tgo.sia.tech/indexd/slabs/manager.go:322"}
indexd-1 | 2026-03-20T13:13:17Z DEBUG postgres.transaction slow exec {"id": "127524e2", "attempt": 1, "query": "UPDATE slabs SET next_repair_attempt = $1 WHERE id = ANY($2)", "elapsed": "106.138672ms", "stack": "go.sia.tech/indexd/persist/postgres.(*txn).Exec\n\tgo.sia.tech/indexd/persist/postgres/sql.go:76\ngo.sia.tech/indexd/persist/postgres.(*Store).UnhealthySlabs.func1\n\tgo.sia.tech/indexd/persist/postgres/sectors.go:849\ngo.sia.tech/indexd/persist/postgres.(*Store).doTransaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:112\ngo.sia.tech/indexd/persist/postgres.(*Store).transaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:64\ngo.sia.tech/indexd/persist/postgres.(*Store).UnhealthySlabs\n\tgo.sia.tech/indexd/persist/postgres/sectors.go:804\ngo.sia.tech/indexd/slabs.(*SlabManager).performSlabMigrations\n\tgo.sia.tech/indexd/slabs/manager.go:356\ngo.sia.tech/indexd/slabs.(*SlabManager).maintenanceLoop.(*SlabManager).maintenanceLoop.func1.func3\n\tgo.sia.tech/indexd/slabs/manager.go:265\nsync.(*WaitGroup).Go.func1\n\tsync/waitgroup.go:258"}
indexd-1 | 2026-03-20T13:09:20Z DEBUG postgres.transaction slow exec {"id": "0e0a80bc", "attempt": 1, "query": "\n\t\t\tUPDATE object_events\n\t\t\tSET updated_at = NOW()\n\t\t\tWHERE (account_id, object_key) IN (\n\t\t\t\tSELECT DISTINCT o.account_id, o.object_key\n\t\t\t\tFROM slab_sectors\n\t\t\t\tINNER JOIN slabs ON slab_sectors.slab_id = slabs.id\n\t\t\t\tINNER JOIN object_slabs ON object_slabs.slab_digest = slabs.digest\n\t\t\t\tINNER JOIN objects o ON object_slabs.object_id = o.id\n\t\t\t\tWHERE slab_sectors.sector_id = $1\n\t\t\t)\n\t\t", "elapsed": "280.481015ms", "stack": "go.sia.tech/indexd/persist/postgres.(*txn).Exec\n\tgo.sia.tech/indexd/persist/postgres/sql.go:76\ngo.sia.tech/indexd/persist/postgres.(*Store).MigrateSector.func1\n\tgo.sia.tech/indexd/persist/postgres/sectors.go:896\ngo.sia.tech/indexd/persist/postgres.(*Store).doTransaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:112\ngo.sia.tech/indexd/persist/postgres.(*Store).transaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:64\ngo.sia.tech/indexd/persist/postgres.(*Store).MigrateSector\n\tgo.sia.tech/indexd/persist/postgres/sectors.go:865\ngo.sia.tech/indexd/slabs.(*SlabManager).uploadShards.func1-range1\n\tgo.sia.tech/indexd/slabs/uploads.go:101\ngo.sia.tech/indexd/slabs.(*SlabManager).uploadShards.func1.(*Candidates).Iter.2\n\tgo.sia.tech/indexd/client/v2/candidates.go:112\ngo.sia.tech/indexd/slabs.(*SlabManager).uploadShards.func1\n\tgo.sia.tech/indexd/slabs/uploads.go:69\nsync.(*WaitGroup).Go.func1\n\tsync/waitgroup.go:258"}
indexd-1 | 2026-03-20T12:47:49Z DEBUG postgres.transaction slow exec {"id": "0e7395df", "attempt": 1, "query": "DELETE FROM contract_sectors_map WHERE id = $1", "elapsed": "648.15057ms", "stack": "go.sia.tech/indexd/persist/postgres.(*txn).Exec\n\tgo.sia.tech/indexd/persist/postgres/sql.go:76\ngo.sia.tech/indexd/persist/postgres.(*Store).DeleteContract.func1\n\tgo.sia.tech/indexd/persist/postgres/contracts.go:751\ngo.sia.tech/indexd/persist/postgres.(*Store).doTransaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:112\ngo.sia.tech/indexd/persist/postgres.(*Store).transaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:64\ngo.sia.tech/indexd/persist/postgres.(*Store).DeleteContract\n\tgo.sia.tech/indexd/persist/postgres/contracts.go:733\ngo.sia.tech/indexd/api/admin.(*admin).handleDELETEContract\n\tgo.sia.tech/indexd/api/admin/admin.go:753\ngo.sia.tech/jape.Mux.adaptor.func4\n\tgo.sia.tech/jape@v0.14.1/server.go:185\ngithub.com/julienschmidt/httprouter.(*Router).ServeHTTP\n\tgithub.com/julienschmidt/httprouter@v1.3.0/router.go:387\nmain.runRootCmd.runRootCmd.BasicAuth.func19.func20\n\tgo.sia.tech/jape@v0.14.1/server.go:244\nnet/http.HandlerFunc.ServeHTTP\n\tnet/http/server.go:2286\nmain.webRouter.ServeHTTP\n\tgo.sia.tech/indexd/cmd/indexd/web.go:18\nnet/http.serverHandler.ServeHTTP\n\tnet/http/server.go:3311\nnet/http.(*conn).serve\n\tnet/http/server.go:2073"}
indexd-1 | 2026-03-20T11:43:21Z DEBUG postgres.transaction slow exec {"id": "f9ab740a", "attempt": 1, "query": "UPDATE hosts SET usage_account_funding = usage_account_funding + $1, usage_total_spent = usage_total_spent + $2 WHERE public_key = $3", "elapsed": "208.475083ms", "stack": "go.sia.tech/indexd/persist/postgres.(*txn).Exec\n\tgo.sia.tech/indexd/persist/postgres/sql.go:76\ngo.sia.tech/indexd/persist/postgres.updateHostUsage\n\tgo.sia.tech/indexd/persist/postgres/contracts.go:937\ngo.sia.tech/indexd/persist/postgres.(*Store).UpdateContractRevision.func1\n\tgo.sia.tech/indexd/persist/postgres/contracts.go:116\ngo.sia.tech/indexd/persist/postgres.(*Store).doTransaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:112\ngo.sia.tech/indexd/persist/postgres.(*Store).transaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:64\ngo.sia.tech/indexd/persist/postgres.(*Store).UpdateContractRevision\n\tgo.sia.tech/indexd/persist/postgres/contracts.go:97\ngo.sia.tech/indexd/contracts.(*RevisionManager).WithRevision\n\tgo.sia.tech/indexd/contracts/revision.go:176\ngo.sia.tech/indexd/contracts.(*ContractManager).pinSectors.func1\n\tgo.sia.tech/indexd/contracts/pinning.go:136\ngo.sia.tech/indexd/contracts.(*ContractManager).pinSectors\n\tgo.sia.tech/indexd/contracts/pinning.go:232\ngo.sia.tech/indexd/contracts.(*ContractManager).performSectorPinningOnHost\n\tgo.sia.tech/indexd/contracts/pinning.go:97\ngo.sia.tech/indexd/contracts.(*ContractManager).performSectorPinning.func1.2\n\tgo.sia.tech/indexd/contracts/pinning.go:54\ngo.sia.tech/indexd/hosts.(*HostManager).WithScannedHost\n\tgo.sia.tech/indexd/hosts/manager.go:382\ngo.sia.tech/indexd/contracts.(*ContractManager).performSectorPinning.func1\n\tgo.sia.tech/indexd/contracts/pinning.go:53"}
indexd-1 | 2026-03-20T08:52:13Z DEBUG postgres.transaction slow exec {"id": "482394c4", "attempt": 1, "query": "UPDATE sectors SET host_id = $1, contract_sectors_map_id = $2 WHERE id = ANY($3)", "elapsed": "118.560964ms", "stack": "go.sia.tech/indexd/persist/postgres.(*txn).Exec\n\tgo.sia.tech/indexd/persist/postgres/sql.go:76\ngo.sia.tech/indexd/persist/postgres.(*Store).PinSectors.func1\n\tgo.sia.tech/indexd/persist/postgres/sectors.go:669\ngo.sia.tech/indexd/persist/postgres.(*Store).doTransaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:112\ngo.sia.tech/indexd/persist/postgres.(*Store).transaction\n\tgo.sia.tech/indexd/persist/postgres/store.go:64\ngo.sia.tech/indexd/persist/postgres.(*Store).PinSectors\n\tgo.sia.tech/indexd/persist/postgres/sectors.go:638\ngo.sia.tech/indexd/contracts.(*ContractManager).pinSectors.func1\n\tgo.sia.tech/indexd/contracts/pinning.go:221\ngo.sia.tech/indexd/contracts.(*ContractManager).pinSectors\n\tgo.sia.tech/indexd/contracts/pinning.go:232\ngo.sia.tech/indexd/contracts.(*ContractManager).performSectorPinningOnHost\n\tgo.sia.tech/indexd/contracts/pinning.go:97\ngo.sia.tech/indexd/contracts.(*ContractManager).performSectorPinning.func1.2\n\tgo.sia.tech/indexd/contracts/pinning.go:54\ngo.sia.tech/indexd/hosts.(*HostManager).WithScannedHost\n\tgo.sia.tech/indexd/hosts/manager.go:382\ngo.sia.tech/indexd/contracts.(*ContractManager).performSectorPinning.func1\n\tgo.sia.tech/indexd/contracts/pinning.go:53"}
This is a tracking issues of queries appearing slow on Zeus. We should keep an eye on them and check if there is anything we can do to improve how long they take to execute.
For some queries that might adding a missing index, batching or an architectural overhaul.