Re: Pre-alloc ListCell's optimization - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: Pre-alloc ListCell's optimization
Date
Msg-id 20120516162439.GT1267@tamriel.snowman.net
Whole thread Raw
In response to Re: Pre-alloc ListCell's optimization  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Pre-alloc ListCell's optimization
List pgsql-hackers
* Stephen Frost (sfrost@snowman.net) wrote:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
> > ISTM the first thing we'd need to have before
> > we could think about this rationally is some measurements about the
> > frequencies of different List lengths in a typical workload.
>
> I agree, that'd be a good thing to have.  I'll look into measuring that.

Ok, it took me, uh, a little while to get around to this, but:

http://tamriel.snowman.net/~sfrost/list_histgram.svg

Is what our list lengths look like for the regression tests.  We could
do a pg_bench run, but it looks like Tom's right here- the vast majority
of our lists are small.  Highlights:

63% are 1-element
25% are 2-element

Lists of 4 or fewer elements are 97%
Lists of 8 or fewer elements are 99%

So, when it comes to palloc() reduction, this patch would eliminate 99%
of palloc's due to lists.  For the regression tests, we're talking about
reducing 893,206 palloc calls to only 1.
Thanks,
    Stephen

pgsql-hackers by date:

Previous
From: Thom Brown
Date:
Subject: Re: Strange issues with 9.2 pg_basebackup & replication
Next
From: Heikki Linnakangas
Date:
Subject: Re: Interrupting long external library calls