RefLib

Reference library for AI

Back

postgresql_16:6.1.15.4 JOIN

PostgreSQL 16 > Server Programming > Extending SQL > Operator Optimization Information > JOIN

The JOIN clause, if provided, names a join selectivity estimation function for the operator. (Note that this is a function name, not an operator name.) JOIN clauses only make sense for binary operators that return boolean. The idea behind a join selectivity estimator is to guess what fraction of the rows in a pair of tables will satisfy a WHERE-clause condition of the form: table1.column1 OP table2.column2 for the current operator. As with the RESTRICT clause, this helps the optimizer very substantially by letting it figure out which of several possible join sequences is likely to take the least work.

As before, this chapter will make no attempt to explain how to write a join selectivity estimator function, but will just suggest that you use one of the standard estimators if one is applicable: eqjoinsel for = neqjoinsel for <> scalarltjoinsel for < scalarlejoinsel for <= scalargtjoinsel for > scalargejoinsel for >= matchingjoinsel for generic matching operators areajoinsel for 2D area-based comparisons positionjoinsel for 2D position-based comparisons contjoinsel for 2D containment-based comparisons

Back