Re: select/update performance?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: select/update performance?
Дата
Msg-id 200311051031.59199.dev@archonet.com
обсуждение исходный текст
Ответ на Re: select/update performance?  (Bjørn T Johansen <btj@havleik.no>)
Список pgsql-general
On Wednesday 05 November 2003 09:49, Bjørn T Johansen wrote:
> Yes, but the table in question have 3 PK and only one that needs this
> "sequence" so I just thought instead of getting holes in the IDs I just
> manually handle this counter somehow.. Not a big deal but... :)

Do you mean a 3-column primary key? By definition you can't have more than one
primary key.

If you absolutely need to have no holes in your sequence numbers (e.g. for
invoices) then you will have to handle it yourself. If you can live with
them, it is much easier and quicker to use a sequence.

If you don't want holes, the simplest way is probably to have a "next_id"
column in a system-settings table. You'll need to lock it before
reading/updating and this will be a bottleneck when inserting new rows.
--
  Richard Huxton
  Archonet Ltd

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

Предыдущее
От: Thierry Missimilly
Дата:
Сообщение: SET AUTOCOMMIT OFF
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: question