Files
next-tjwater-server/resources/sql/009_analysis_runtime_query_indexes.sql

13 lines
405 B
PL/PgSQL

-- Bound and index the persisted analysis reads used by the workbench and API.
-- Safe to re-run after analysis.runs and analysis.results are provisioned.
BEGIN;
CREATE INDEX IF NOT EXISTS runs_created_at_run_id_idx
ON analysis.runs(created_at DESC, run_id);
CREATE INDEX IF NOT EXISTS results_run_created_at_result_id_idx
ON analysis.results(run_id, created_at DESC, result_id DESC);
COMMIT;