Re: Using a postgres table to maintain unique id?

Поиск
Список
Период
Сортировка
От M.Feldtmann@t-online.de (Marten Feldtmann)
Тема Re: Using a postgres table to maintain unique id?
Дата
Msg-id 3A104CA9.6E313C9F@toppoint.de
обсуждение исходный текст
Ответ на Re: Using a postgres table to maintain unique id?  (Poet/Joshua Drake <poet@linuxports.com>)
Список pgsql-sql

Steve Wampler schrieb:
> 
> Poet/Joshua Drake wrote:
> ?
> ? ?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?
> 
> Can someone show me how to create (and use) an int8 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?
Throw away all the "hardwired"-stuff and do it with software. I
once described an algorithm in one of this lists how to create 
unique values for clients without minimum interaction with the 
database.
The result: query once in the beginning of your application, 
generate your id's "offline" at the maximum speed you may
have and store your last generated id when your client
finished. Superior to all the "hardwired"-database solutions !

Marten


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

Предыдущее
От: Kyle
Дата:
Сообщение: Bug or feature
Следующее
От: Clayton Cottingham
Дата:
Сообщение: Re: MySQL -> Postgres dump converter