Skip to content
Snippets Groups Projects

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

Pipeline #1429 passed

Pipeline passed for 38987444 on olasd:bugfix/visit_find_by_date_index_scan

Approval is optional

Merged by Nicolas DandrimontNicolas Dandrimont 1 year ago (Mar 14, 2023 1:42pm UTC)

Merge details

  • Changes merged into master with 38987444.
  • Deleted the source branch.
  • Auto-merge enabled

Pipeline #1451 passed

Pipeline passed for 38987444 on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading