Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ddl/migrations/0225_track_routes_slug_allocation_idx.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Supports ETL track route allocation:
--
-- SELECT MAX(collision_id)
-- FROM track_routes
-- WHERE owner_id = ?
-- AND title_slug = ?
--
-- The primary key covers (owner_id, slug), but not title_slug. Track creates
-- run this lookup before inserting each track_routes row, so give Postgres a
-- narrow index for the slug-allocation path.
CREATE INDEX CONCURRENTLY IF NOT EXISTS track_routes_owner_title_slug_collision_idx
ON public.track_routes USING btree (owner_id, title_slug, collision_id DESC);
Loading