postgresql/contrib/pageinspect
Amit Kapila b0eaa4c51b Avoid creation of the free space map for small heap relations, take 2.
Previously, all heaps had FSMs. For very small tables, this means that the
FSM took up more space than the heap did. This is wasteful, so now we
refrain from creating the FSM for heaps with 4 pages or fewer. If the last
known target block has insufficient space, we still try to insert into some
other page before giving up and extending the relation, since doing
otherwise leads to table bloat. Testing showed that trying every page
penalized performance slightly, so we compromise and try every other page.
This way, we visit at most two pages. Any pages with wasted free space
become visible at next relation extension, so we still control table bloat.
As a bonus, directly attempting one or two pages can even be faster than
consulting the FSM would have been.

Once the FSM is created for a heap we don't remove it even if somebody
deletes all the rows from the corresponding relation.  We don't think it is
a useful optimization as it is quite likely that relation will again grow
to the same size.

Author: John Naylor, Amit Kapila
Reviewed-by: Amit Kapila
Tested-by: Mithun C Y
Discussion: https://www.postgresql.org/message-id/CAJVSVGWvB13PzpbLEecFuGFc5V2fsO736BsdTakPiPAcdMM5tQ@mail.gmail.com
2019-02-04 07:49:15 +05:30
..
expected Avoid creation of the free space map for small heap relations, take 2. 2019-02-04 07:49:15 +05:30
sql Avoid creation of the free space map for small heap relations, take 2. 2019-02-04 07:49:15 +05:30
.gitignore pageinspect: Add tests 2016-11-01 14:02:16 -04:00
Makefile Skip full index scan during cleanup of B-tree indexes when possible 2018-04-04 19:29:00 +03:00
brinfuncs.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
btreefuncs.c Replace heapam.h includes with {table, relation}.h where applicable. 2019-01-21 10:51:37 -08:00
fsmfuncs.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
ginfuncs.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
hashfuncs.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
heapfuncs.c Replace heapam.h includes with {table, relation}.h where applicable. 2019-01-21 10:51:37 -08:00
pageinspect--1.0--1.1.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
pageinspect--1.1--1.2.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
pageinspect--1.2--1.3.sql pageinspect/BRIN: minor tweaks 2014-12-02 12:20:50 -03:00
pageinspect--1.3--1.4.sql Add forgotten file in commit d6061f83a1 2015-11-25 16:59:07 +03:00
pageinspect--1.4--1.5.sql Update pageinspect extension for parallel query. 2016-06-09 17:18:09 -04:00
pageinspect--1.5--1.6.sql pageinspect: Add bt_page_items function with bytea argument 2017-04-04 23:52:55 -04:00
pageinspect--1.5.sql Update pageinspect extension for parallel query. 2016-06-09 17:18:09 -04:00
pageinspect--1.6--1.7.sql Skip full index scan during cleanup of B-tree indexes when possible 2018-04-04 19:29:00 +03:00
pageinspect--unpackaged--1.0.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
pageinspect.control Skip full index scan during cleanup of B-tree indexes when possible 2018-04-04 19:29:00 +03:00
pageinspect.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
rawpage.c Replace heapam.h includes with {table, relation}.h where applicable. 2019-01-21 10:51:37 -08:00