1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-15 02:22:24 +03:00

Extend join-selectivity API (oprjoin interface) so that join type is

passed to join selectivity estimators.  Make use of this in eqjoinsel
to derive non-bogus selectivity for IN clauses.  Further tweaking of
cost estimation for IN.
initdb forced because of pg_proc.h changes.
This commit is contained in:
Tom Lane
2003-01-28 22:13:41 +00:00
parent 955a1f81a7
commit 2e46b762eb
16 changed files with 222 additions and 137 deletions

View File

@@ -530,16 +530,17 @@ WHERE p1.oprrest = p2.oid AND
-- If oprjoin is set, the operator must be a binary boolean op,
-- and it must link to a proc with the right signature
-- to be a join selectivity estimator.
-- The proc signature we want is: float8 proc(internal, oid, internal)
-- The proc signature we want is: float8 proc(internal, oid, internal, int2)
SELECT p1.oid, p1.oprname, p2.oid, p2.proname
FROM pg_operator AS p1, pg_proc AS p2
WHERE p1.oprjoin = p2.oid AND
(p1.oprkind != 'b' OR p1.oprresult != 'bool'::regtype OR
p2.prorettype != 'float8'::regtype OR p2.proretset OR
p2.pronargs != 3 OR
p2.pronargs != 4 OR
p2.proargtypes[0] != 'internal'::regtype OR
p2.proargtypes[1] != 'oid'::regtype OR
p2.proargtypes[2] != 'internal'::regtype);
p2.proargtypes[2] != 'internal'::regtype OR
p2.proargtypes[3] != 'int2'::regtype);
oid | oprname | oid | proname
-----+---------+-----+---------
(0 rows)

View File

@@ -134,10 +134,10 @@ SELECT '' AS five, f1 AS "Correlated Field"
WHERE f3 IS NOT NULL);
five | Correlated Field
------+------------------
| 1
| 2
| 2
| 3
| 1
| 2
| 3
(5 rows)

View File

@@ -444,17 +444,18 @@ WHERE p1.oprrest = p2.oid AND
-- If oprjoin is set, the operator must be a binary boolean op,
-- and it must link to a proc with the right signature
-- to be a join selectivity estimator.
-- The proc signature we want is: float8 proc(internal, oid, internal)
-- The proc signature we want is: float8 proc(internal, oid, internal, int2)
SELECT p1.oid, p1.oprname, p2.oid, p2.proname
FROM pg_operator AS p1, pg_proc AS p2
WHERE p1.oprjoin = p2.oid AND
(p1.oprkind != 'b' OR p1.oprresult != 'bool'::regtype OR
p2.prorettype != 'float8'::regtype OR p2.proretset OR
p2.pronargs != 3 OR
p2.pronargs != 4 OR
p2.proargtypes[0] != 'internal'::regtype OR
p2.proargtypes[1] != 'oid'::regtype OR
p2.proargtypes[2] != 'internal'::regtype);
p2.proargtypes[2] != 'internal'::regtype OR
p2.proargtypes[3] != 'int2'::regtype);
-- **************** pg_aggregate ****************