Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(nuq-postgres): add index on owner_id for backlog query optimization (#2941)

tomsideguide8bd538df5ebd
diff --git a/apps/nuq-postgres/nuq.sql b/apps/nuq-postgres/nuq.sql
index e551d2003..1e8fb60e9 100644
--- a/apps/nuq-postgres/nuq.sql
+++ b/apps/nuq-postgres/nuq.sql
@@ -99,6 +99,9 @@ CREATE TABLE IF NOT EXISTS nuq.queue_scrape_backlog (
CONSTRAINT queue_scrape_backlog_pkey PRIMARY KEY (id)
);
+-- For getBackloggedJobIDsOfOwner: query backlog by owner_id
+CREATE INDEX IF NOT EXISTS nuq_queue_scrape_backlog_owner_id_idx ON nuq.queue_scrape_backlog (owner_id);
+
-- For getGroupNumericStats backlog query: query by group_id and data->>'mode' on backlog table
CREATE INDEX IF NOT EXISTS nuq_queue_scrape_backlog_group_mode_idx ON nuq.queue_scrape_backlog (group_id) WHERE ((data->>'mode') = 'single_urls');