Re: [SQL] Sequential non unique IDs

2008-04-06 Thread John Reeve
. Thanks again! - John -Original Message- From: Craig Ringer [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2008 9:24 PM To: John Reeve Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Sequential non unique IDs John Reeve wrote: > I've already considered: > 1. I can'

Re: [SQL] Sequential non unique IDs

2008-04-01 Thread Volkan YAZICI
On Tue, 1 Apr 2008, "John Reeve" <[EMAIL PROTECTED]> writes: > I have the following scenario: > > A 'task' table that has the fields: > id => primary key, updated on each insert using a sequence > customerid => integer > localid => integer > > I need the localid to be sequential an

Re: [SQL] Sequential non unique IDs

2008-04-01 Thread Craig Ringer
John Reeve wrote: > I've already considered: > 1. I can't lock the table, because there are too many inserts happening > and it will slow down the app. In a locking approach you may not need to lock the whole table. You should only need to lock the entry for the customer being altered, eg: BEGIN

[SQL] Sequential non unique IDs

2008-04-01 Thread John Reeve
I have the following scenario: A 'task' table that has the fields: id => primary key, updated on each insert using a sequence customerid => integer localid => integer I need the localid to be sequential and unique per unique customerid. The data needs to look like this: 1, 92, 1