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

From: John Naylor <jcnaylor(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: Avoid creation of the free space map for small tables
Date: 2018-11-05 09:28:17
Message-ID: CAJVSVGUh+cw2oHqAohD33TECoQM4pXQgb9a20mtTG1mGNv2uNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/2/18, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> On a FSM-less table, I'd be inclined to just check the
> last page and then grow the table if the tuple doesn't fit there.
> This would, in many cases, soon result in a FSM being created, but
> I think that's just fine. The point of the change is to optimize
> for cases where a table *never* gets more than a few inserts. Not, IMO,
> for cases where a table gets a lot of churn but never has a whole lot of
> live tuples. In the latter scenario we are far better off having a FSM.

and...

On 11/2/18, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Just checking the last page of the table doesn't sound like a good
> idea to me. I think that will just lead to a lot of stupid bloat. It
> seems likely that checking every page of the table is fine for npages
> <= 3, and that would still be win in a very significant number of
> cases,

I see the merit of both of these arguments, and it occurred to me that
there is middle ground between checking only the last page and
checking every page: Check the last 3 pages and set the threshold to
6. That way, with npages <= 3, every page will be checked. In the
unlikely case that npages = 6 and the first 3 pages are all wasted
space, that's the amount of space that would have gone to the FSM
anyway, and the relation will likely grow beyond the threshold soon,
at which point the free space will become visible again.

-John Naylor

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2018-11-05 10:43:16 Re: ToDo: show size of partitioned table
Previous Message Peter Eisentraut 2018-11-05 09:22:51 Re: bugfix: BUG #15477: Procedure call with named inout refcursor parameter - "invalid input syntax for type boolean"