pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave E Martin XXIII <postgresql-to.dave@dave.to>
To: Bruno Wolff III <bruno@wolff.to>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Index speeds up one row table (why)?
Date: Mon, 02 Jun 2003 01:14:30 -0600
Message-ID: <3EDAF956.9010307@dave.to> (raw)
References: <3ED93338.80806@dave.to>
	<1054434573.11968.42.camel@jester>
	<3ED9A923.90500@dave.to>
	<20030601190409.GA7853@wolff.to>

Bruno Wolff III wrote:

>Maybe you should reconsider how badly you want the app to be totally database
>agnostic? Using a sequence might be less of a contortion than using vacuum
>a few times a minute. You are likely to have similar performance issues
>with other databases, so this section of code may not turn out to be very
>portable in any case.
>  
>
Maybe I can further abstract out the generate unique-id portion, Since 
unique-id generation does seem to be a pretty common database extension 
(for some reason...), and then provide a generic schema definition, and 
a postgresql specific one (along with whatever others I can drum up). 
The generic one will rely on the software to come up with the unique id 
in the fashion I'm currently doing.

Speaking of which, is there a better way than what i'm currently doing 
(when the database doesn't have any such support)? I've heard of one 
method based on something like "select max(id)+1 from table" but this 
seems error prone, at the very least, you'd have to have a unique index, 
and be prepared to redo on failure, which could get messy if its a big 
transaction, and frequent if there is a lot of concurrent inserting 
going on.





view thread (8+ messages)  latest in thread

Message-ID: <3EDAF956.9010307@dave.to>
Permalink:  ../3EDAF956.9010307@dave.to/
Also on:    postgresql.org/message-id/3EDAF956.9010307@dave.to

 · 

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-performance@postgresql.org
  Cc: postgresql-to.dave@dave.to, bruno@wolff.to, pgsql-bugs@postgresql.org
  Subject: Re: Index speeds up one row table (why)?
  In-Reply-To: <3EDAF956.9010307@dave.to>
  References: <3ED93338.80806@dave.to> <1054434573.11968.42.camel@jester> <3ED9A923.90500@dave.to> <20030601190409.GA7853@wolff.to> <3EDAF956.9010307@dave.to>

* 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