diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-09 02:36:04 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-09 02:36:04 +0000 |
commit | 51db6455eac8aa5b0078cefffed51a6257ccbe1d (patch) | |
tree | b32ee35da610ebae0397bec58e0ad57143a21517 /src/backend/utils/cache/lsyscache.c | |
parent | 45500964f61b0ec671b84b1fdb988bad78f35473 (diff) | |
download | postgresql-51db6455eac8aa5b0078cefffed51a6257ccbe1d.tar.gz postgresql-51db6455eac8aa5b0078cefffed51a6257ccbe1d.zip |
Repair error noticed by Roberto Cornacchia: selectivity code
was rejecting negative attnums as bogus, which of course they are not.
Add code to get_attdisbursion to produce a useful value for OID attribute,
since VACUUM does not store stats for system attributes.
Also, repair bug that's been in eqjoinsel for a long time: it was taking
the max of the two columns' disbursions, whereas it should use the min.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 4f9cd3fefa7..75994a31f27 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -6,7 +6,7 @@ * Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.33 1999/08/16 02:06:25 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.34 1999/09/09 02:36:04 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -224,6 +224,14 @@ get_attdisbursion(Oid relid, AttrNumber attnum, double min_estimate) return 1.0 / (double) ntuples; /* + * VACUUM ANALYZE does not compute disbursion for system attributes, + * but some of them can reasonably be assumed unique anyway. + */ + if (attnum == ObjectIdAttributeNumber || + attnum == SelfItemPointerAttributeNumber) + return 1.0 / (double) ntuples; + + /* * VACUUM ANALYZE has not been run for this table. * Produce an estimate = 1/numtuples. This may produce * unreasonably small estimates for large tables, so limit |