diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-15 19:35:48 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-15 19:35:48 +0000 |
| commit | de97072e3c88e104a55b0d5c67477f1b0097c003 (patch) | |
| tree | b4b0a243ce6d38ae6aa5cde1e3ef140e229a1615 /doc/src | |
| parent | 0eed62f34d95d5c7ae7e0931cfe632f4c8373ec0 (diff) | |
Allow merge and hash joins to occur on arbitrary expressions (anything not
containing a volatile function), rather than only on 'Var = Var' clauses
as before. This makes it practical to do flatten_join_alias_vars at the
start of planning, which in turn eliminates a bunch of klugery inside the
planner to deal with alias vars. As a free side effect, we now detect
implied equality of non-Var expressions; for example in
SELECT ... WHERE a.x = b.y and b.y = 42
we will deduce a.x = 42 and use that as a restriction qual on a. Also,
we can remove the restriction introduced 12/5/02 to prevent pullup of
subqueries whose targetlists contain sublinks.
Still TODO: make statistical estimation routines in selfuncs.c and costsize.c
smarter about expressions that are more complex than plain Vars. The need
for this is considerably greater now that we have to be able to estimate
the suitability of merge and hash join techniques on such expressions.
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/xoper.sgml | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/doc/src/sgml/xoper.sgml b/doc/src/sgml/xoper.sgml index 395306bbd60..24c74cd8b60 100644 --- a/doc/src/sgml/xoper.sgml +++ b/doc/src/sgml/xoper.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/xoper.sgml,v 1.21 2003/01/06 01:20:40 tgl Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/xoper.sgml,v 1.22 2003/01/15 19:35:35 tgl Exp $ --> <Chapter Id="xoper"> @@ -375,6 +375,27 @@ table1.column1 OP table2.column2 equality operators that are (or could be) implemented by <function>memcmp()</function>. </para> + <note> + <para> + The function underlying a hashjoinable operator must be marked + immutable or stable. If it is volatile, the system will never + attempt to use the operator for a hash join. + </para> + </note> + + <note> + <para> + If a hashjoinable operator has an underlying function that is marked + strict, the + function must also be complete: that is, it should return TRUE or + FALSE, never NULL, for any two non-NULL inputs. If this rule is + not followed, hash-optimization of <literal>IN</> operations may + generate wrong results. (Specifically, <literal>IN</> might return + FALSE where the correct answer per spec would be NULL; or it might + yield an error complaining that it wasn't prepared for a NULL result.) + </para> + </note> + </sect2> <sect2> @@ -474,6 +495,14 @@ table1.column1 OP table2.column2 <note> <para> + The function underlying a mergejoinable operator must be marked + immutable or stable. If it is volatile, the system will never + attempt to use the operator for a merge join. + </para> + </note> + + <note> + <para> <literal>GROUP BY</> and <literal>DISTINCT</> operations require each datatype being grouped or compared to have a mergejoinable equality operator named <literal>=</>. The equality operator and its |
