Skip to content

Commit

Permalink
fix: optimise pin content cid query (#1573)
Browse files Browse the repository at this point in the history
* fix: create index on pin(content_cid, status)

* chore: create index concurrently
  • Loading branch information
flea89 authored Jun 27, 2022
1 parent a42e762 commit c315143
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX CONCURRENTLY IF NOT EXISTS pin_content_cid_status_idx ON pin (content_cid, status);
1 change: 1 addition & 0 deletions packages/db/postgres/tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ CREATE INDEX IF NOT EXISTS pin_location_id_idx ON pin (pin_location_id);
CREATE INDEX IF NOT EXISTS pin_updated_at_idx ON pin (updated_at);
CREATE INDEX IF NOT EXISTS pin_status_idx ON pin (status);
CREATE INDEX IF NOT EXISTS pin_composite_updated_at_and_content_cid_idx ON pin (updated_at, content_cid);
CREATE INDEX IF NOT EXISTS pin_content_cid_status_idx ON pin (content_cid, status);

-- An upload created by a user.
CREATE TABLE IF NOT EXISTS upload
Expand Down

0 comments on commit c315143

Please sign in to comment.