| From: | Dani Oderbolz <oderbolz(at)ecologic(dot)de> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Change the behaviour of the SERIAL "Type" |
| Date: | 2003-06-27 14:35:36 |
| Message-ID: | 3EFC5638.5040406@ecologic.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rod Taylor | 2003-06-27 14:55:19 | Re: Change the behaviour of the SERIAL "Type" |
| Previous Message | Bruno Wolff III | 2003-06-27 14:26:35 | Re: Change the behaviour of the SERIAL "Type" |