Re: Using a postgres table to maintain unique id?

Поиск
Список
Период
Сортировка
От Poet/Joshua Drake
Тема Re: Using a postgres table to maintain unique id?
Дата
Msg-id Pine.LNX.4.30.0011130925400.2094-100000@crazypenguins.commandprompt.com
обсуждение исходный текст
Ответ на Using a postgres table to maintain unique id?  (Steve Wampler <swampler@noao.edu>)
Список pgsql-sql
>However, I also use Postgres (7.0.2) throughout this
>application and it seems cleaner to me to keep the current
>id value in a table and just use postgres to provide access
>(with a trigger function to increment the id on access).

Why not a sequence?

>Is this reasonable?  Is it fast?  (I need 10 or more IDs
>generated each second.)  Can I avoid having the table
>gradually fill with "old" rows for this entry, and this
>avoid the need to run VACUUM ANALYZE periodically?

The only problem I have had with this type of thing is when a number gets
deleted, it does not get recycled.

Joshua Drake


>
>Any tips on how to implement the trigger would be
>appreciated.  (Is it possible to generate an int8 sequence
>value?)
>
>Thanks!
>--
>Steve Wampler-  SOLIS Project, National Solar Observatory
>swampler@noao.edu
>

-- 
--
<COMPANY>CommandPrompt    - http://www.commandprompt.com    </COMPANY>
<PROJECT>OpenDocs, LLC.    - http://www.opendocs.org    </PROJECT>
<PROJECT>LinuxPorts     - http://www.linuxports.com     </PROJECT>
<WEBMASTER>LDP        - http://www.linuxdoc.org    </WEBMASTER>
--
Instead of asking why a piece of software is using "1970s technology,"
start asking why software is ignoring 30 years of accumulated wisdom.
--



В списке pgsql-sql по дате отправления:

Предыдущее
От: Steve Wampler
Дата:
Сообщение: Using a postgres table to maintain unique id?
Следующее
От: Steve Wampler
Дата:
Сообщение: Re: Using a postgres table to maintain unique id?