]> granicus.if.org Git - postgresql/commit
Improve GIN indexscan cost estimation.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 18 Oct 2010 00:52:32 +0000 (20:52 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 18 Oct 2010 00:52:32 +0000 (20:52 -0400)
commit48c7d9f6ff99714495b7d6d2ebc44fbbe992cc8f
tree73082c19da244fedf1bfc81d5c5eb2a1f3eddd9e
parentcd0e8253216907982fe369b91f6d788d699b6c47
Improve GIN indexscan cost estimation.

The better estimate requires more statistics than we previously stored:
in particular, counts of "entry" versus "data" pages within the index,
as well as knowledge of the number of distinct key values.  We collect
this information during initial index build and update it during VACUUM,
storing the info in new fields on the index metapage.  No initdb is
required because these fields will read as zeroes in a pre-existing
index, and the new gincostestimate code is coded to behave (reasonably)
sanely if they are zeroes.

Teodor Sigaev, reviewed by Jan Urbanski, Tom Lane, and Itagaki Takahiro.
src/backend/access/gin/ginbtree.c
src/backend/access/gin/gindatapage.c
src/backend/access/gin/ginentrypage.c
src/backend/access/gin/ginfast.c
src/backend/access/gin/gininsert.c
src/backend/access/gin/ginutil.c
src/backend/access/gin/ginvacuum.c
src/backend/access/gin/ginxlog.c
src/backend/utils/adt/selfuncs.c
src/include/access/gin.h