diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-06-05 05:26:05 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-06-05 05:26:05 +0000 |
commit | 7c579fa12df0def35192e1e3cfc9ea7ab90bb0cb (patch) | |
tree | 70886176df00ac556e7992fde6e2ffd7c90530f9 /src/backend/utils/adt/selfuncs.c | |
parent | 28d2420eefdacfa928138d4b302fd6a31286225b (diff) | |
download | postgresql-7c579fa12df0def35192e1e3cfc9ea7ab90bb0cb.tar.gz postgresql-7c579fa12df0def35192e1e3cfc9ea7ab90bb0cb.zip |
Further work on making use of new statistics in planner. Adjust APIs
of costsize.c routines to pass Query root, so that costsize can figure
more things out by itself and not be so dependent on its callers to tell
it everything it needs to know. Use selectivity of hash or merge clause
to estimate number of tuples processed internally in these joins
(this is more useful than it would've been before, since eqjoinsel is
somewhat more accurate than before).
Diffstat (limited to 'src/backend/utils/adt/selfuncs.c')
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 1c9b3c60b9d..a56ac81042a 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.91 2001/05/27 17:37:48 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.92 2001/06/05 05:26:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1132,10 +1132,12 @@ eqjoinsel(PG_FUNCTION_ARGS) totalsel2 += otherfreq2 * (otherfreq1 + unmatchfreq1) / (nd1 - nmatches); /* - * For robustness, we average the two estimates. (Can a case - * be made for taking the min or max instead?) + * Use the smaller of the two estimates. This can be justified + * in essentially the same terms as given below for the no-stats + * case: to a first approximation, we are estimating from the + * point of view of the relation with smaller nd. */ - selec = (totalsel1 + totalsel2) * 0.5; + selec = (totalsel1 < totalsel2) ? totalsel1 : totalsel2; } else { |