Re: [JDBC] [PERFORM] is a good practice to create an index on the

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: [JDBC] [PERFORM] is a good practice to create an index on the
Дата
Msg-id 20040428083223.GA8384@wolff.to
обсуждение исходный текст
Ответ на Re: [JDBC] [PERFORM] is a good practice to create an index on the  (Edoardo Ceccarelli <eddy@axa.it>)
Список pgsql-admin
On Wed, Apr 28, 2004 at 10:13:14 +0200,
  Edoardo Ceccarelli <eddy@axa.it> wrote:
> do you mean that, declaring an index serial, I'd never have to deal with
> incrementing its primary key? good to know!

That isn't what is happening. Serial is a special type. It is int plus
a default rule linked to a sequence. No index is created by default
for the serial type. Declaring a column as a primary key will however
create a unique index on that column.

Also note that you should only assume that the serial values are unique.
(This assumes that you don't use setval and that you don't roll a sequence
over.) Within a single session you can assume the sequence values will
be monotonicly increasing. The values that end up in your table can have
gaps. Typically this happens when a transaction rolls back after obtaining
a new value from a sequence. It can also happen if you grab sequence
values in larger blocks (which might be more efficient if a session normally
acquires mulitple values from a particular sequence) than the default 1.

> anyway  in this particular situation I don't need such accurate
> behaviour: this table is filled up with a lot of data twice per week and
> it's used only to answer queries.
> I could drop it whenever I want :)

You really don't want to use oids.

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

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: [JDBC] [PERFORM] is a good practice to create an index on the
Следующее
От: Ben Kim
Дата:
Сообщение: parametrized query