From: Dani Oderbolz <oderbolz@ecologic.de>
To: pgsql-sql@postgresql.org
Subject: Re: Change the behaviour of the SERIAL "Type"
Date: Fri, 27 Jun 2003 16:35:36 +0200
Message-ID: <3EFC5638.5040406@ecologic.de> (raw)
In-Reply-To: <20030627142635.GB15269@wolff.to>
References: <FA785BC0-A7EF-11D7-8248-000A957653D6@tercent.net>
<3EFC0413.7090006@ecologic.de>
<20030627142635.GB15269@wolff.to>
Bruno Wolff III wrote:
> ...
>
>
>It shouldn't be too difficult to write some triggers that make something
>closer to autoincrement. It probably won't work very well if there are
>lots of concurrent updates though. You can either lock the table with
>the column exclusively and then find the largest value and then use
>that value plus one. Don't use max for this. Make an index on the
>autoincrement column and use order by and limit 1 to get the largest
>value. The other option is to keep the sequence value in other table.
>You can use select for update to update it. You will want to vacuum
>this table often enough that it will stay on one page.
>
Well, why not just use the Sequence?
Is there really such a performance hit when calling a trigger?
In Oracle, one usually does such a thing, as there is no such nice
workaround
as SERIAL.
Hmm, I am still thinking about a special kinf of SERIAL, maybe called
TRIGGERED_SERIAL which creates a trigger instead of a DEFAULT.
Cheers,
Dani
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: pgsql-sql@postgresql.org
Cc: oderbolz@ecologic.de
Subject: Re: Change the behaviour of the SERIAL "Type"
In-Reply-To: <3EFC5638.5040406@ecologic.de>
* 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