From: | Bob Pawley <rjpawley(at)shaw(dot)ca> |
---|---|
To: | Gevik Babakhani <pgdev(at)xs4all(dot)nl> |
Cc: | Postgresql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: serial column |
Date: | 2006-09-24 22:29:14 |
Message-ID: | 009901c6e028$dda130c0$8e904618@owner |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"A possible solution for this would be to regenerate the entire column's
values every time a record gets deleted starting form 1. but then again
this would be very slow if you have a very large table"
I don't anticipate the table to be more than a few hundred rows - certainly
fewer than 1,000.
Could you point to some documentation for regenerating a column's values
other than manual??
Bob
----- Original Message -----
From: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
To: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
Cc: "Postgresql" <pgsql-general(at)postgresql(dot)org>
Sent: Sunday, September 24, 2006 3:19 PM
Subject: Re: [GENERAL] serial column
> On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote:
>> It's the behavior I expect - but the gaps aren't acceptable.
>>
>> Bob
>
> Then using the SERIAL or SEQUENCE won't do you any good.
>
> A possible solution for this would be to regenerate the entire column's
> values every time a record gets deleted starting form 1. but then again
> this would be very slow if you have a very large table
>
> Another solution would be to have two triggers, one for delete and one
> for insert plus an extra *reserve* table to reserve the deleted value.
> The delete trigger would save the *deleted* values in the reserve table
> and when a new record is inserted the insert trigger first would check
> the reserve table for deleted values (that are stored by the delete
> trigger) if a value exist then it would use that value or increment that
> last value.
>
> However if you want to use a *no gap* sequence as a primary key, you
> should be aware that you will destroy the integrity of you data.
>
>
>
>
> --
> Regards,
> Gevik Babakhani
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-09-24 22:30:40 | Re: how much free space in tables and index ? |
Previous Message | Michael Fuhr | 2006-09-24 22:28:40 | Re: how much free space in tables and index ? |