From: Sandro Santilli Date: Fri, 22 Apr 2005 01:05:41 +0000 (+0000) Subject: Fixed bug in join selectivity estimator returning invalid estimates (>1) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4419ec5627aeda7acc97cc91fb42f3def9a65a2a;p=postgis Fixed bug in join selectivity estimator returning invalid estimates (>1) git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@1668 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/lwgeom/lwgeom_estimate.c b/lwgeom/lwgeom_estimate.c index 03849f963..0fbeb03c1 100644 --- a/lwgeom/lwgeom_estimate.c +++ b/lwgeom/lwgeom_estimate.c @@ -984,6 +984,9 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS) PG_RETURN_FLOAT8(DEFAULT_GEOMETRY_JOINSEL); } + if ( rows_returned > total_tuples ) + PG_RETURN_FLOAT8(1.0); + PG_RETURN_FLOAT8(rows_returned / total_tuples); } @@ -2482,6 +2485,9 @@ Datum LWGEOM_estimated_extent(PG_FUNCTION_ARGS) /********************************************************************** * $Log$ + * Revision 1.29.2.3 2005/04/22 01:05:41 strk + * Fixed bug in join selectivity estimator returning invalid estimates (>1) + * * Revision 1.29.2.2 2005/04/18 14:12:59 strk * Slightly changed standard deviation computation to be more corner-case-friendly. *