Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize catalog query: do not order when computing totals #2959

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

javitonino
Copy link
Contributor

This removes the ORDER BY clause when computing totals/facets. It's completely unnecessary there (no need to sort if we are just interested in the count) and it can mess with the optimizer in bad ways (making it prefer the index for the sort rather than the order for the filter). This is responsible for all the recent p99 outliers.

@javitonino javitonino merged commit 5642aaf into main Mar 10, 2025
32 checks passed
@javitonino javitonino deleted the optimize_catalog_query branch March 10, 2025 14:23
Copy link

codecov bot commented Mar 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.14%. Comparing base (0ad193b) to head (de4d6f2).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2959      +/-   ##
==========================================
+ Coverage   84.01%   84.14%   +0.12%     
==========================================
  Files         487      487              
  Lines       35972    35979       +7     
  Branches    10966    10966              
==========================================
+ Hits        30222    30273      +51     
+ Misses       5224     5180      -44     
  Partials      526      526              
Flag Coverage Δ
nidx 77.54% <ø> (ø)
nucliadb 76.05% <100.00%> (+0.26%) ⬆️
nucliadb-ingest 40.67% <16.66%> (-0.02%) ⬇️
nucliadb-reader 42.06% <16.66%> (-0.02%) ⬇️
nucliadb-search 45.04% <75.00%> (+0.01%) ⬆️
nucliadb-standalone 46.17% <16.66%> (-0.02%) ⬇️
nucliadb-train 44.77% <16.66%> (-0.02%) ⬇️
nucliadb-writer 46.83% <16.66%> (-0.04%) ⬇️
nucliadb_dataset 55.45% <ø> (ø)
nucliadb_models 84.27% <ø> (ø)
nucliadb_sdk 93.01% <ø> (ø)
nucliadb_telemetry 86.53% <ø> (ø)
nucliadb_utils 84.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants