1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

First cut at making useful selectivity estimates for range queries

(ie, WHERE x > lowbound AND x < highbound).  It's not very bright yet
but it does something useful.  Also, rename intltsel/intgtsel to
scalarltsel/scalargtsel to reflect usage better.  Extend convert_to_scalar
to do something a little bit useful with string data types.  Still need
to make it do something with date/time datatypes, but I'll wait for
Thomas's datetime unification dust to settle first.  Eventually the
routine ought not have any type-specific knowledge at all; it ought to
be calling a type-dependent routine found via a pg_type column; but
that's a task for another day.
This commit is contained in:
Tom Lane
2000-01-24 07:16:52 +00:00
parent 8bcac56086
commit 0dbffa704a
9 changed files with 529 additions and 248 deletions

View File

@ -7,7 +7,7 @@
--
-- Copyright (c) 1994, Regents of the University of California
--
-- $Id: complex.source,v 1.5 2000/01/22 23:50:30 tgl Exp $
-- $Id: complex.source,v 1.6 2000/01/24 07:16:48 tgl Exp $
--
---------------------------------------------------------------------------
@ -148,15 +148,13 @@ CREATE FUNCTION complex_abs_ge(complex, complex) RETURNS bool
CREATE FUNCTION complex_abs_gt(complex, complex) RETURNS bool
AS '_OBJWD_/complex.so' LANGUAGE 'c';
-- the restrict and join selectivity functions are bogus (notice we only
-- have intltsel, eqsel and intgtsel)
CREATE OPERATOR < (
leftarg = complex, rightarg = complex, procedure = complex_abs_lt,
restrict = intltsel, join = intltjoinsel
restrict = scalarltsel, join = scalarltjoinsel
);
CREATE OPERATOR <= (
leftarg = complex, rightarg = complex, procedure = complex_abs_le,
restrict = intltsel, join = intltjoinsel
restrict = scalarltsel, join = scalarltjoinsel
);
CREATE OPERATOR = (
leftarg = complex, rightarg = complex, procedure = complex_abs_eq,
@ -164,11 +162,11 @@ CREATE OPERATOR = (
);
CREATE OPERATOR >= (
leftarg = complex, rightarg = complex, procedure = complex_abs_ge,
restrict = intgtsel, join = intgtjoinsel
restrict = scalargtsel, join = scalargtjoinsel
);
CREATE OPERATOR > (
leftarg = complex, rightarg = complex, procedure = complex_abs_gt,
restrict = intgtsel, join = intgtjoinsel
restrict = scalargtsel, join = scalargtjoinsel
);
INSERT INTO pg_opclass VALUES ('complex_abs_ops');