77 * Portions Copyright (c) 1994, Regents of the University of California
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.39 2000/01/26 05:57:17 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.40 2000/02/16 01:00:23 tgl Exp $
1111 *
1212 * NOTES
1313 * Eventually, the index information should go through here, too.
@@ -183,6 +183,7 @@ double
183183get_attdisbursion (Oid relid ,AttrNumber attnum ,double min_estimate )
184184{
185185HeapTuple atp ;
186+ Form_pg_attribute att_tup ;
186187double disbursion ;
187188int32 ntuples ;
188189
@@ -197,10 +198,21 @@ get_attdisbursion(Oid relid, AttrNumber attnum, double min_estimate)
197198relid ,attnum );
198199return min_estimate ;
199200}
201+ att_tup = (Form_pg_attribute )GETSTRUCT (atp );
200202
201- disbursion = (( Form_pg_attribute ) GETSTRUCT ( atp )) -> attdisbursion ;
203+ disbursion = att_tup -> attdisbursion ;
202204if (disbursion > 0.0 )
203- return disbursion ;/* we have a specific estimate */
205+ return disbursion ;/* we have a specific estimate from VACUUM */
206+
207+ /*
208+ * Special-case boolean columns: the disbursion of a boolean is highly
209+ * unlikely to be anywhere near 1/numtuples, instead it's probably more
210+ * like 0.5.
211+ *
212+ * Are there any other cases we should wire in special estimates for?
213+ */
214+ if (att_tup -> atttypid == BOOLOID )
215+ return 0.5 ;
204216
205217/*
206218 * Disbursion is either 0 (no data available) or -1 (disbursion