Skip to content

Commit

Permalink
fix: add necessary indexes for table optimization (#258)
Browse files Browse the repository at this point in the history
Affects asset_group_collections and asset_group_collection_entries
This migration will also truncate asset_group_collection_entries to
reset table size
  • Loading branch information
superlinkx authored Dec 7, 2023
1 parent 1b61cd2 commit e3b72e1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/api/src/database/migration/migrations/v5.3.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE INDEX IF NOT EXISTS idx_asset_group_collections_asset_group_id ON asset_group_collections USING btree (asset_group_id);
CREATE INDEX IF NOT EXISTS idx_asset_group_collections_created_at ON asset_group_collections USING btree (created_at);
CREATE INDEX IF NOT EXISTS idx_asset_group_collections_updated_at ON asset_group_collections USING btree (updated_at);

CREATE INDEX IF NOT EXISTS idx_asset_group_collection_entries_asset_group_collection_id ON asset_group_collection_entries USING btree (asset_group_collection_id);
CREATE INDEX IF NOT EXISTS idx_asset_group_collection_entries_created_at ON asset_group_collection_entries USING btree (created_at);
CREATE INDEX IF NOT EXISTS idx_asset_group_collection_entries_updated_at ON asset_group_collection_entries USING btree (updated_at);

TRUNCATE asset_group_collection_entries;

0 comments on commit e3b72e1

Please sign in to comment.