Closed hohonuuli closed 1 year ago
Whoa. Thanks for looking into that. Fingers crossed this will help
Attempting to add the following but it's running slooooooooow (Edit. It took 3 minutes to add the index)
CREATE INDEX Event_track_uuid_index
ON dbo.Event (track_uuid)
GO
@danellecline The indexes will make a huge difference. I'll add them to any column that is used for search (e.g. Event.media_id, Event.class_id, etc).
Adding
create index Event_media_id_index
on dbo.Event (media_id)
go
Media table:
create index Media_job_id_index
on dbo.Media (job_id)
go
create index Media_uuid_index
on dbo.Media (uuid)
go
Running the following still took 45 seconds. Look at views to see how they are constructed ...
select
*
from
Track
where
media_id = 44
Running SELECT * FROM Event WHERE media_id = 44
returns 53100 records in 741ms
Additional indices could be created on Job and User but they're so small I'm skipping.
Currently there are only indices on the primary keys. The
Event
table had 91 million rows, so definitely needed.cc: @danellecline