Skip to content

Commit

Permalink
Add index on host_id & created_at in the statuses table
Browse files Browse the repository at this point in the history
This should make the queries noticeably faster.
  • Loading branch information
nothingface0 committed Jan 7, 2025
1 parent 586c401 commit 37bee62
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sql/migrations/0001_indexes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ CREATE INDEX IF NOT EXISTS runs_hostname_index ON runs (hostname);

CREATE INDEX IF NOT EXISTS hostnames_name_index ON hostnames (name);

CREATE INDEX IF NOT EXISTS hoststatuses_host_id_index ON hoststatuses (host_id);
CREATE INDEX IF NOT EXISTS hoststatuses_host_id_index ON hoststatuses (host_id);

CREATE INDEX IF NOT EXISTS hoststatuses_host_id_created_at ON hoststatuses (host_id, created_at DESC);

0 comments on commit 37bee62

Please sign in to comment.