From f905d65ee35b3f84b6d4433a5198af0e2e7bd090 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 7 May 2001 00:43:27 +0000 Subject: Rewrite of planner statistics-gathering code. ANALYZE is now available as a separate statement (though it can still be invoked as part of VACUUM, too). pg_statistic redesigned to be more flexible about what statistics are stored. ANALYZE now collects a list of several of the most common values, not just one, plus a histogram (not just the min and max values). Random sampling is used to make the process reasonably fast even on very large tables. The number of values and histogram bins collected is now user-settable via an ALTER TABLE command. There is more still to do; the new stats are not being used everywhere they could be in the planner. But the remaining changes for this project should be localized, and the behavior is already better than before. A not-very-related change is that sorting now makes use of btree comparison routines if it can find one, rather than invoking '<' twice. --- src/backend/parser/parse_relation.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/backend/parser/parse_relation.c') diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index f5324cb3735..e1d49842fd2 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.54 2001/04/18 17:04:24 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.55 2001/05/07 00:43:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -75,7 +75,7 @@ static struct } }; -#define SPECIALS ((int) (sizeof(special_attr)/sizeof(special_attr[0]))) +#define SPECIALS ((int) lengthof(special_attr)) /* @@ -670,7 +670,7 @@ isForUpdate(ParseState *pstate, char *relname) foreach(l, pstate->p_forUpdate) { - char *rname = lfirst(l); + char *rname = strVal(lfirst(l)); if (strcmp(relname, rname) == 0) return true; @@ -1020,20 +1020,6 @@ attnameIsSet(Relation rd, char *name) #endif -#ifdef NOT_USED -/* - * This should only be used if the relation is already - * heap_open()'ed. Use the cache version - * for access to non-opened relations. - */ -int -attnumAttNelems(Relation rd, int attid) -{ - return rd->rd_att->attrs[attid - 1]->attnelems; -} - -#endif - /* given attribute id, return type of that attribute */ /* * This should only be used if the relation is already -- cgit v1.2.3