Staging instance, all changes can be removed at any time

Skip to content

postgresql: Rewrite swh_visit_find_by_date to properly use existing indexes

swh_visit_find_by_date tries to do an index only scan on origin_visit (origin, date). However, by sorting the results on an extra column (the visit id), the postgresql planner would end up doing an index scan, which times out on origins with lots of visits.

Splitting the work across two steps (first find the date, which works with index only scans, then find the highest visit id, which usually only returns one row) fixes this issue.

Merge request reports

Loading