Re: WIP: Avoid creation of the free space map for small tables

Mithun Cy <mithun.cy@enterprisedb.com>

From: Mithun Cy <mithun.cy@enterprisedb.com>
To: John Naylor <jcnaylor@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-01-09T12:33:37Z
Lists: pgsql-hackers
Hi John Naylor,
On Tue, Jan 8, 2019 at 2:27 AM John Naylor <jcnaylor@gmail.com> wrote:
> I've attached two patches for testing. Each one applies on top of the
> current patch.

Thanks for the patch, I did a quick test for both of the patches same
tests as in [1], now for fillfactors 20, 70, 100 (Note for
HEAP_FSM_CREATION_THRESHOLD = 4 highest tid inserted was 20 fillfactor
is (3,43),  for 70 fillfactor is (3, 157) and for 100 fillfactor is
(3, 225), so exactly 4 pages are used)

Machine : cthulhu, same as before [2] and server settings is default.
Test: COPY command as in [1], for 500 tables.

Fill factor 20
                      execution time in ms            %increase in
execution time
Base                             119.238
v11-all-pages                121.974                 2.2945705228
v11-Every-other-page   114.455                 -4.0113051209
v11-last-page                113.573                 -4.7510021973

Fill factor 70
                     execution time in ms           %increase in execution time
Base                              209.991
v11-all-pages                 211.076                0.5166888105
v11-Every-other-page    206.476              -1.6738812616
v11-last-page                 203.591              -3.0477496655

Fill factor 100
                   execution time in ms            %increase in execution time
Base                              269.691
v11-all-pages                 270.078                 0.1434975583
v11-Every-other-page    262.691                -2.5955630703
v11-last-page                 260.293                -3.4847288193

Observations
1. Execution time of both base and v11-all-pages patch has improved
than my earlier results [2]. But still v11-all-pages is slightly
behind base.
2. v11-Every-other-page and v11-last-page patches improve the
performance from base.
3. IMHO v11-Every-other-page would be ideal to consider it improves
the performance and also to an extent avoid expansion if space is
already available.

[1] https://www.postgresql.org/message-id/CAJVSVGX%3D2Q52fwijD9cjeq1UdiYGXns2_9WAPFf%3DE8cwbFCDvQ%40mail.gmail.com
[2] https://www.postgresql.org/message-id/CAD__Ouj%3Dat4hy2wYidK90v92qSRLjU%2BQe4y-PwfjLLeGkhc6ZA%40mail.gmail.com

-- 
Thanks and Regards
Mithun Chicklore Yogendra
EnterpriseDB: http://www.enterprisedb.com


Commits

  1. Improve code comments in b0eaa4c51b.

  2. During pg_upgrade, conditionally skip transfer of FSMs.

  3. Add more tests for FSM.

  4. Doc: Update the documentation for FSM behavior for small tables.

  5. Make FSM test portable.

  6. Avoid creation of the free space map for small heap relations, take 2.

  7. Move page initialization from RelationAddExtraBlocks() to use, take 2.

  8. Avoid creation of the free space map for small heap relations.

  9. In bootstrap mode, don't allow the creation of files if they don't already