agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Heikki Linnakangas <[email protected]>
To: Tom Lane <[email protected]>
Cc: Jaime Casanova <[email protected]>
Cc: Jim C. Nasby <[email protected]>
Cc: Bruce Momjian <[email protected]>
Cc: PostgreSQL-patches <[email protected]>
Subject: Re: Maintaining cluster order on insert
Date: Fri, 18 May 2007 16:19:18 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

Tom Lane wrote:
> Heikki Linnakangas <[email protected]> writes:
>> The beef of the patch is two new optional indexam API functions: 
>> amprepareinsert and amfinishinsert. amprepareinsert is called before 
>> inserting the heap tuple. It descends the tree and finds and pins the 
>> right leaf page to insert to, and returns a suggestion on where the heap 
>> tuple should be inserted. amfinishinsert is called after inserting the 
>> heap tuple to actually insert the index tuple. Documentation for these 
>> functions need to be added indexam.sgml, I noticed that that's not done yet.
> 
> What happens when there's more than one index?

You can only cluster a table on one index. The other index inserts will 
use the aminsert-function, after inserting the heap tuple as usual.

> Is there a risk of deadlock during concurrent insertions (from different
> processes trying to lock the same buffers in different orders)?

No, should be ok. btprepareinsert function will release locks (but not 
the pin) after descending the tree, and btfinishinsert will reacquire 
them. The locking order is the same as today.

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



view thread (47+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Maintaining cluster order on insert
  In-Reply-To: <[email protected]>

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

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