Phone numbers and web links: primary_for ignores rows already prefetched, so a sync pays two queries per contact #1171

Closed
opened 2026-10-31 03:04:37 +00:00 by tiagoagueda · 0 comments
Owner

postulo-dav computes a digest of every contact on every run, and each one costs two queries for the primary phone number and the primary web link, because phone_numbers.primary_for and web_links.primary_for query even when the holder's rows were prefetched.

What would change

Both functions read the holder's prefetched rows when phone_numbers or web_links is in its _prefetched_objects_cache, and query as today otherwise. Same answer, no new surface name. A test asserts zero queries for a prefetched holder. postulo-dav then adds the prefetch to its contacts query.

Accessibility

None.

The whole finding, with its measurements and decisions, is postulo/postulo-dav#47.


Found by the efficiency and reliability audit of 2026-10-30 (finding PR7; index postulo/postulo#1108). Checked against main at daee30b15 (2026-10-30).

postulo-dav computes a digest of every contact on every run, and each one costs two queries for the primary phone number and the primary web link, because `phone_numbers.primary_for` and `web_links.primary_for` query even when the holder's rows were prefetched. ## What would change Both functions read the holder's prefetched rows when `phone_numbers` or `web_links` is in its `_prefetched_objects_cache`, and query as today otherwise. Same answer, no new surface name. A test asserts zero queries for a prefetched holder. postulo-dav then adds the prefetch to its contacts query. ## Accessibility None. The whole finding, with its measurements and decisions, is postulo/postulo-dav#47. --- Found by the efficiency and reliability audit of 2026-10-30 (finding PR7; index postulo/postulo#1108). Checked against `main` at `daee30b15` (2026-10-30).
tiagoagueda added this to the 0.6.0 milestone 2026-10-31 03:04:37 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#1171
No description provided.