HomeSoftware Heritage

postgresql: ensure origin_visit(_status) queries use index
75aa07325d6cUnpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

postgresql: ensure origin_visit(_status) queries use index

When using an inner join for the single origin value, instead of a
subquery, the query fails to use the (origin, visit) indexes and falls
back to fetching all the visits (or all the statuses) for the origin and
sorting them.

This breaks down for origins with a lot of visits, such as the ones that
are being used for end to end monitoring.

Using a subselect to generate a single origin id value ensures that the
queries can use the proper indexes.

Details

Provenance
olasdAuthored on Apr 12 2022, 1:53 PM
olasdPushed on Apr 12 2022, 2:22 PM
Parents
R65:035d4c1dd19e: origin_get_with_statuses: Rename RPC endpoint path
Branches
Unknown
Tags
Unknown
References
tag: phabricator/diff/27390, tag: phabricator/base/27421, tag: phabricator/base/27416

Event Timeline