From e289dc11b74fed09159b14a2cada1ee21e2988f8 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Tue, 29 Oct 2024 15:31:41 -0700 Subject: [PATCH] fix indexes --- rwf/src/model/migrations/bootstrap.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rwf/src/model/migrations/bootstrap.sql b/rwf/src/model/migrations/bootstrap.sql index fdc7d619..ef6b6bf8 100644 --- a/rwf/src/model/migrations/bootstrap.sql +++ b/rwf/src/model/migrations/bootstrap.sql @@ -46,8 +46,8 @@ CREATE TABLE IF NOT EXISTS rwf_requests ( duration REAL NOT NULL ); -CREATE INDEX IF NOT EXISTS rwf_requests_path_created_at ON rwf_requests USING btree(created_at, path); +CREATE INDEX IF NOT EXISTS rwf_requests_path_created_at ON rwf_requests USING btree(created_at, path, client_id); -CREATE INDEX IF NOT EXISTS rwf_requests_errors ON rwf_requests USING btree(created_at, client_id, code) WHERE code >= 400; +CREATE INDEX IF NOT EXISTS rwf_requests_errors ON rwf_requests USING btree(created_at, code, client_id) WHERE code >= 400; -CREATE INDEX IF NOT EXISTS rwf_requests_too_slow ON rwf_requests USING btree(created_at, duration) WHERE duration >= 1000.0; -- the unit is milliseconds +CREATE INDEX IF NOT EXISTS rwf_requests_too_slow ON rwf_requests USING btree(created_at, duration, client_id) WHERE duration >= 1000.0; -- the unit is milliseconds