]> granicus.if.org Git - postgis/commitdiff
Fixed bug in join selectivity estimator returning invalid estimates (>1)
authorSandro Santilli <strk@keybit.net>
Fri, 22 Apr 2005 01:07:09 +0000 (01:07 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 22 Apr 2005 01:07:09 +0000 (01:07 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1669 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_estimate.c

index 1338c52a7702fac36e229584c88a3f5a09ff1654..d5bee88079e1c656198edcec6dc46628cf20bfdd 100644 (file)
@@ -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.32  2005/04/22 01:07:09  strk
+ * Fixed bug in join selectivity estimator returning invalid estimates (>1)
+ *
  * Revision 1.31  2005/04/18 14:12:43  strk
  * Slightly changed standard deviation computation to be more corner-case-friendly.
  *