jrgemignani commented on PR #2417:
URL: https://github.com/apache/age/pull/2417#issuecomment-4654420694

   @crprashant Btw, this was what it suggests -
   ## Why
   
   The containment (`@>`, `<@`, `@>>`, `<<@`) and key-existence (`?`, `?|`, 
`?&`) operators on `agtype` are bound to `matchingsel` / `matchingjoinsel`. 
During planning, `matchingsel` invokes the operator's underlying function 
(`agtype_contains`) once per `pg_statistic` MCV entry (and per histogram bin). 
With a realistic `default_statistics_target`, that planning cost dominates 
simple OLTP-style point queries — the regression reported in #2356.
   
   This PR rebinds those operators to the lightweight `contsel` / `contjoinsel` 
estimators, which return fixed selectivity constants without calling the 
operator function. This is a deliberate trade-off: we give up 
MCV/histogram-based estimate accuracy for `agtype` containment in exchange for 
constant-time planning.
   
   Note this is **not** the binding PostgreSQL core uses for `jsonb` — core 
keeps jsonb's `@>`, `<@`, `?`, `?|`, `?&` on `matchingsel` / `matchingjoinsel` 
(verified on REL_16/17/18_STABLE). So this is an AGE-specific choice favoring 
workloads where these operators appear in selective point lookups, not a 
core-precedent restoration. A future improvement (tracked separately) could add 
a custom `agtype` selectivity function that is both cheap and statistics-aware.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to