pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: tom@tomforb.es
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6629: Creating a gist index fails with "too many LWLocks taken"
Date: Tue, 08 May 2012 10:22:35 +0300
Message-ID: <4FA8C9BB.2050703@enterprisedb.com> (raw)
In-Reply-To: <27017.1336405902@sss.pgh.pa.us>
References: <E1SQkyu-0004nP-IW@wrigleys.postgresql.org>
	<4FA7EC37.5070703@enterprisedb.com>
	<27017.1336405902@sss.pgh.pa.us>

On 07.05.2012 18:51, Tom Lane wrote:
> Heikki Linnakangas<heikki.linnakangas@enterprisedb.com>  writes:
>> I wrote a quick patch to do that, and with the patch the index build
>> finished - but it took hours. And the index was 10GB in size, where the
>> heap is just 12 MB, and searches using the index take ages.
>
> Hm, is the example exploiting some pessimal behavior in the picksplit
> logic for the particular opclass?  Maybe that's something to fix, too.

Yep. I added an elog() to picksplit to print how many tuples went to 
left and right pages. This seems to be the same behavior described here: 
http://archives.postgresql.org/pgsql-performance/2009-04/msg00320.php, 
where one entry goes to one page, and all the rest to the other page. We 
changed the picksplit algorithm for 'seg' to fix that. I'm not too 
familiar with these datatypes, I'm not sure if we could do the same for 
intarray.

Tom F's original test case used arrays of 50 integers, but you can see 
the same with much smaller arrays, too. Here's a snippet of the output 
with arrays of five integers:

LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 9 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 60 - 63
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 9 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 9 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 10
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 10
LOG:  --------picksplit 9 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 10
LOG:  --------picksplit 10 - 1
LOG:  --------picksplit 1 - 10
LOG:  --------picksplit 9 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 10 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 9 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 9 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 9 - 1
LOG:  --------picksplit 1 - 9
LOG:  --------picksplit 61 - 62
LOG:  --------picksplit 9 - 1
...

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (18+ messages)  latest in thread

Message-ID: <4FA8C9BB.2050703@enterprisedb.com>
Permalink:  ../4FA8C9BB.2050703@enterprisedb.com/
Also on:    postgresql.org/message-id/4FA8C9BB.2050703@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: heikki.linnakangas@enterprisedb.com, tgl@sss.pgh.pa.us, tom@tomforb.es
  Subject: Re: BUG #6629: Creating a gist index fails with "too many LWLocks taken"
  In-Reply-To: <4FA8C9BB.2050703@enterprisedb.com>
  References: <E1SQkyu-0004nP-IW@wrigleys.postgresql.org> <4FA7EC37.5070703@enterprisedb.com> <27017.1336405902@sss.pgh.pa.us> <4FA8C9BB.2050703@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox