Robert HaasSr. Staff Software Engineer @ Databricks, PostgreSQL Developer and Committer

Projects › Query Performance

Planner Conceptual Errors

NOT IN is hard to optimize

cross-data-type comparisons are not always indexable

target lists are computed too early or unnecessarily

inlining can lose if we inline the same thing multiple times

The query planner does not deduce implied inequalities.

See 676.1308068945@sss.pgh.pa.us

It won’t propagate IN or other criteria either: e.g. a IN (…) and a = b does not imply b IN (…)

Can’t rewrite SELECT max(blah) WHERE dork IN (…) as max of index scans

Query planner isn’t smart about rearranging aggregates and joins

WHERE a OR b not equivalent to WHERE a UNION WHERE b

Can’t implement partitioned join as UNION of joins (and then push GROUP BY through it!)

Planner doesn’t translate between IN (…) and =ANY(ARRAY((subquery))

GIN can’t decide to index some AND-ed quals but not others

Range operators can’t use btree indexes on base types

STRICT functions are hard to inline

Only unqualified baserels can be pulled up into an appendrel

Planner converts IN clauses to semijoins before constant simplification

Query planner doesn’t discard unnecessary sorts

Parameterized queries defeat constraint exclusion