Add extended statistics on search(key, value) for planner accuracy
The search table is an EAV schema where key and value are highly correlated, but standard single-column statistics can't model this. This caused the planner to underestimate compound filter queries by up to 1300x, choosing materialize-then-sort plans instead of LIMIT short-circuit index scans. CREATE STATISTICS captures the (key, value) correlation via dependencies, ndistinct, and most-common-values metadata. The planner then correctly estimates row counts and chooses the index-driven plan. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Added extended multi-column statistics on `(key, value)` in the `search` table (PostgreSQL only). This tells the query planner about the correlation between the `key` and `value` columns, fixing severe row count estimation errors on compound filter queries. Without this, the planner could choose to materialize and sort thousands of rows instead of using the LIMIT short-circuit index scan — causing 10-40x slower catalog list views when multiple filters are active.
|
||||
Reference in New Issue
Block a user