pgsql: Clean up code associated with updating pg_class statistics
Log Message:
-----------
Clean up code associated with updating pg_class statistics columns
(relpages/reltuples). To do this, create formal support in heapam.c for
"overwrite" tuple updates (including xlog replay capability) and use that
instead of the ad-hoc overwrites we'd been using in VACUUM and CREATE INDEX.
Take the responsibility for updating stats during CREATE INDEX out of the
individual index AMs, and do it where it belongs, in catalog/index.c. Aside
from being more modular, this avoids having to update the same tuple twice in
some paths through CREATE INDEX. It's probably not measurably faster, but
for sure it's a lot cleaner than before.
Modified Files:
--------------
pgsql/doc/src/sgml:
indexam.sgml (r2.10 -> r2.11)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/indexam.sgml.diff?r1=2.10&r2=2.11)
pgsql/src/backend/access/gin:
gininsert.c (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/gin/gininsert.c.diff?r1=1.1&r2=1.2)
pgsql/src/backend/access/gist:
gist.c (r1.133 -> r1.134)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/gist/gist.c.diff?r1=1.133&r2=1.134)
pgsql/src/backend/access/hash:
hash.c (r1.89 -> r1.90)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hash.c.diff?r1=1.89&r2=1.90)
pgsql/src/backend/access/heap:
heapam.c (r1.211 -> r1.212)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/heapam.c.diff?r1=1.211&r2=1.212)
pgsql/src/backend/access/nbtree:
nbtree.c (r1.148 -> r1.149)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtree.c.diff?r1=1.148&r2=1.149)
pgsql/src/backend/bootstrap:
bootstrap.c (r1.214 -> r1.215)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/bootstrap/bootstrap.c.diff?r1=1.214&r2=1.215)
pgsql/src/backend/catalog:
heap.c (r1.298 -> r1.299)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/heap.c.diff?r1=1.298&r2=1.299)
index.c (r1.265 -> r1.266)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/index.c.diff?r1=1.265&r2=1.266)
pgsql/src/backend/commands:
indexcmds.c (r1.138 -> r1.139)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/indexcmds.c.diff?r1=1.138&r2=1.139)
tablecmds.c (r1.183 -> r1.184)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c.diff?r1=1.183&r2=1.184)
vacuum.c (r1.329 -> r1.330)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuum.c.diff?r1=1.329&r2=1.330)
pgsql/src/include/access:
genam.h (r1.59 -> r1.60)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/access/genam.h.diff?r1=1.59&r2=1.60)
heapam.h (r1.110 -> r1.111)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/access/heapam.h.diff?r1=1.110&r2=1.111)
htup.h (r1.81 -> r1.82)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/access/htup.h.diff?r1=1.81&r2=1.82)
pgsql/src/include/catalog:
index.h (r1.65 -> r1.66)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/index.h.diff?r1=1.65&r2=1.66)
pg_proc.h (r1.410 -> r1.411)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h.diff?r1=1.410&r2=1.411)
Tom Lane wrote:
Log Message:
-----------
Clean up code associated with updating pg_class statistics columns
(relpages/reltuples). To do this, create formal support in heapam.c for
"overwrite" tuple updates (including xlog replay capability) and use that
instead of the ad-hoc overwrites we'd been using in VACUUM and CREATE INDEX.
Take the responsibility for updating stats during CREATE INDEX out of the
individual index AMs, and do it where it belongs, in catalog/index.c. Aside
from being more modular, this avoids having to update the same tuple twice in
some paths through CREATE INDEX. It's probably not measurably faster, but
for sure it's a lot cleaner than before.
Minor comment: since you removed the ----- lines from the index_create
header comment, I think pgindent will mess up the alignment for that
comment, which probably will not be very nice. Same in
index_update_stats. Otherwise, nice work! I will update my relminxid
patch to this and re-submit.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
Alvaro Herrera <alvherre@commandprompt.com> writes:
Minor comment: since you removed the ----- lines from the index_create
header comment, I think pgindent will mess up the alignment for that
comment, which probably will not be very nice. Same in
index_update_stats. Otherwise, nice work! I will update my relminxid
patch to this and re-submit.
No, left-justified comments aren't subject to reindenting (correct Bruce?)
Certainly there are plenty of other function header comments that don't
have any ---.
regards, tom lane
Tom Lane wrote:
Alvaro Herrera <alvherre@commandprompt.com> writes:
Minor comment: since you removed the ----- lines from the index_create
header comment, I think pgindent will mess up the alignment for that
comment, which probably will not be very nice. Same in
index_update_stats. Otherwise, nice work! I will update my relminxid
patch to this and re-submit.No, left-justified comments aren't subject to reindenting (correct Bruce?)
Correct.
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +