diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-12-29 20:11:45 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-12-29 20:11:45 +0000 |
commit | 649b5ec7c8a3050a30bd6d36003ba3a681c9a198 (patch) | |
tree | af041b646426d71d9ea1113837b5f7a9001082c9 /src/backend/utils/cache/lsyscache.c | |
parent | 84d723b6cefcf25b8c800f8aa6cf3c9538a546b4 (diff) |
Add the ability to store inheritance-tree statistics in pg_statistic,
and teach ANALYZE to compute such stats for tables that have subclasses.
Per my proposal of yesterday.
autovacuum still needs to be taught about running ANALYZE on parent tables
when their subclasses change, but the feature is useful even without that.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 0b50309bf36..fc1c21bc4a9 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.163 2009/08/10 05:46:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.164 2009/12/29 20:11:45 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -2524,6 +2524,9 @@ get_typmodout(Oid typid) * Given the table and attribute number of a column, get the average * width of entries in the column. Return zero if no data available. * + * Currently this is only consulted for individual tables, not for inheritance + * trees, so we don't need an "inh" parameter. + * * Calling a hook at this point looks somewhat strange, but is required * because the optimizer calls this function without any other way for * plug-ins to control the result. @@ -2540,10 +2543,11 @@ get_attavgwidth(Oid relid, AttrNumber attnum) if (stawidth > 0) return stawidth; } - tp = SearchSysCache(STATRELATT, + tp = SearchSysCache(STATRELATTINH, ObjectIdGetDatum(relid), Int16GetDatum(attnum), - 0, 0); + BoolGetDatum(false), + 0); if (HeapTupleIsValid(tp)) { stawidth = ((Form_pg_statistic) GETSTRUCT(tp))->stawidth; @@ -2609,7 +2613,7 @@ get_attstatsslot(HeapTuple statstuple, if (values) { - val = SysCacheGetAttr(STATRELATT, statstuple, + val = SysCacheGetAttr(STATRELATTINH, statstuple, Anum_pg_statistic_stavalues1 + i, &isnull); if (isnull) @@ -2658,7 +2662,7 @@ get_attstatsslot(HeapTuple statstuple, if (numbers) { - val = SysCacheGetAttr(STATRELATT, statstuple, + val = SysCacheGetAttr(STATRELATTINH, statstuple, Anum_pg_statistic_stanumbers1 + i, &isnull); if (isnull) |