Skip to content

v0.13.1-alpha — counts query optimization

Pre-release
Pre-release

Choose a tag to compare

@Shepdesign Shepdesign released this 03 Jun 21:12
· 57 commits to main since this release

A focused performance patch on top of v0.13.0-alpha.

Changed

Drill-down counts query — 7.5× faster

The counts behind the /filter endpoint grouped by (facet_value, facet_display) — two 191-char VARCHARs — which bloated the aggregation temp table. Since the value→display mapping is 1:1 (slug→name, ID→title, or value === display for meta), the query now GROUP BY facet_value alone and takes the display via MIN(facet_display):

  • Identical output — byte-for-byte the same buckets (verified on the live 100k stack: same 21 category buckets, same counts).
  • 454ms → 60ms on the counts query, taking resolve() p95 from ~465ms → ~63ms uncached on 100k products.
  • COUNT(DISTINCT object_id) is kept (not COUNT(*)) so a multi-row-per-object meta facet still counts each object once.

Together with the v0.13.0 result-set cache, the /filter path is now fast on both cold (~63ms) and repeat (sub-ms) hits. SQL shape is locked by a unit test.

Note: EXPLAIN reported both the old and new queries as "Using temporary; Using filesort" — only wall-clock measurement exposed the 7.5× gap. Measure, don't trust the plan.

Verification

  • PHP: 121 tests / 269 assertions; php -l clean
  • JS: 35 tests; build clean · Markdown: lint clean
  • Live stack: identical buckets confirmed; resolve() re-benchmarked at ~63ms p95

Upgrade

git pull && composer install && npm install

No schema change, no reindex, no behavior change — purely a faster query.

Full changelog: CHANGELOG.md