Aded mention that != maps to <>.

This commit is contained in:
Bruce Momjian 1996-11-30 04:56:18 +00:00
parent 440279e803
commit d3e0860d25
1 changed files with 41 additions and 6 deletions

View File

@ -1,6 +1,6 @@
.\" This is -*-nroff-*- .\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here.... .\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_operator.l,v 1.1 1996/11/14 10:15:58 scrappy Exp $ .\" $Header: /cvsroot/pgsql/src/man/Attic/create_operator.l,v 1.2 1996/11/30 04:56:18 momjian Exp $
.TH "CREATE OPERATOR" SQL 11/05/95 Postgres95 Postgres95 .TH "CREATE OPERATOR" SQL 11/05/95 Postgres95 Postgres95
.SH NAME .SH NAME
create operator \(em define a new user operator create operator \(em define a new user operator
@ -33,14 +33,22 @@ The
is a sequence of up to sixteen punctuation characters. The following is a sequence of up to sixteen punctuation characters. The following
characters are valid for single-character operator names: characters are valid for single-character operator names:
.nf .nf
.ce 1
~ ! @ # % ^ & ` ? ~ ! @ # % ^ & ` ?
.fi .fi
If the operator name is more than one character long, it may consist If the operator name is more than one character long, it may consist
of any combination of the above characters or the following additional of any combination of the above characters or the following additional
characters: characters:
.nf .nf
.ce 1
| $ : + - * / < > = | $ : + - * / < > =
.fi .fi
The operator "!=" is mapped to "<>" on input, and they are
therefore equivalent.
.PP .PP
At least one of At least one of
.IR leftarg .IR leftarg
@ -86,22 +94,34 @@ area-greater-than, <<<. Suppose that an operator, area-equal, ===,
exists, as well as an area not equal, !==. Hence, the query optimizer exists, as well as an area not equal, !==. Hence, the query optimizer
could freely convert: could freely convert:
.nf .nf
.ce 1
"0,0,1,1"::box >>> MYBOXES.description "0,0,1,1"::box >>> MYBOXES.description
.fi .fi
to to
.nf .nf
.ce 1
MYBOXES.description <<< "0,0,1,1"::box MYBOXES.description <<< "0,0,1,1"::box
.fi .fi
This allows the execution code to always use the latter representation This allows the execution code to always use the latter representation
and simplifies the query optimizer somewhat. and simplifies the query optimizer somewhat.
.PP .PP
The negator operator allows the query optimizer to convert The negator operator allows the query optimizer to convert
.nf .nf
not MYBOXES.description === "0,0,1,1"::box
.ce 1
NOT MYBOXES.description === "0,0,1,1"::box
.fi .fi
to to
.nf .nf
.ce 1
MYBOXES.description !== "0,0,1,1"::box MYBOXES.description !== "0,0,1,1"::box
.fi .fi
If a commutator operator name is supplied, Postgres searches for it in If a commutator operator name is supplied, Postgres searches for it in
the catalog. If it is found and it does not yet have a commutator the catalog. If it is found and it does not yet have a commutator
@ -124,11 +144,17 @@ along the lines of [SHAP86]; however, it must know whether this
strategy is applicable. For example, a hash-join algorithm is usable strategy is applicable. For example, a hash-join algorithm is usable
for a clause of the form: for a clause of the form:
.nf .nf
.ce 1
MYBOXES.description === MYBOXES2.description MYBOXES.description === MYBOXES2.description
.fi .fi
but not for a clause of the form: but not for a clause of the form:
.nf .nf
.ce 1
MYBOXES.description <<< MYBOXES2.description. MYBOXES.description <<< MYBOXES2.description.
.fi .fi
The The
.BR hashes .BR hashes
@ -141,7 +167,10 @@ be used to sort the two operand classes. For the === clause above,
the optimizer must sort both relations using the operator, <<<. On the optimizer must sort both relations using the operator, <<<. On
the other hand, merge-sort is not usable with the clause: the other hand, merge-sort is not usable with the clause:
.nf .nf
.ce 1
MYBOXES.description <<< MYBOXES2.description MYBOXES.description <<< MYBOXES2.description
.fi .fi
If other join strategies are found to be practical, Postgres will change If other join strategies are found to be practical, Postgres will change
the optimizer and run-time system to use them and will require the optimizer and run-time system to use them and will require
@ -153,7 +182,10 @@ be worth the complexity involved.
The last two pieces of the specification are present so the query The last two pieces of the specification are present so the query
optimizer can estimate result sizes. If a clause of the form: optimizer can estimate result sizes. If a clause of the form:
.nf .nf
.ce 1
MYBOXES.description <<< "0,0,1,1"::box MYBOXES.description <<< "0,0,1,1"::box
.fi .fi
is present in the qualification, then Postgres may have to estimate the is present in the qualification, then Postgres may have to estimate the
fraction of the instances in MYBOXES that satisfy the clause. The fraction of the instances in MYBOXES that satisfy the clause. The
@ -162,10 +194,7 @@ defined using
.IR "define function" (l)) .IR "define function" (l))
which accepts one argument of the correct data type and returns a which accepts one argument of the correct data type and returns a
floating point number. The query optimizer simply calls this floating point number. The query optimizer simply calls this
function, passing the parameter function, passing the parameter "0,0,1,1"
.nf
"0,0,1,1"
.fi
and multiplies the result by the relation size to get the desired and multiplies the result by the relation size to get the desired
expected number of instances. expected number of instances.
.PP .PP
@ -177,11 +206,17 @@ classes involved to compute the desired expected result size.
.PP .PP
The difference between the function The difference between the function
.nf .nf
.ce 1
my_procedure_1 (MYBOXES.description, "0,0,1,1"::box) my_procedure_1 (MYBOXES.description, "0,0,1,1"::box)
.fi .fi
and the operator and the operator
.nf .nf
.ce 1
MYBOXES.description === "0,0,1,1"::box MYBOXES.description === "0,0,1,1"::box
.fi .fi
is that Postgres attempts to optimize operators and can decide to use an is that Postgres attempts to optimize operators and can decide to use an
index to restrict the search space when operators are involved. index to restrict the search space when operators are involved.