Re: Primary Key Increment Doesn't Seem Correct Under Table Partition

Поиск
Список
Период
Сортировка
Искать
От
Alban Hertroys
Тема
Re: Primary Key Increment Doesn't Seem Correct Under Table Partition
Дата
Msg-id
20E1D1DD-DA3C-44D4-8A4E-9FB924A49E9C@solfertje.student.utwente.nl
Ответ на
Список
Дерево обсуждения
Re: Primary Key Increment Doesn't Seem Correct Under Table Partition Yan Cheng Cheok <yccheok@yahoo.com>
Re: Primary Key Increment Doesn't Seem Correct Under Table Partition Alban Hertroys <dalroi@solfertje.student.utwente.nl>
Re: Primary Key Increment Doesn't Seem Correct Under Table Partition Yan Cheng Cheok <yccheok@yahoo.com>
Re: Primary Key Increment Doesn't Seem Correct Under Table Partition Alban Hertroys <dalroi@solfertje.student.utwente.nl>
Re: Primary Key Increment Doesn't Seem Correct Under Table Partition Yan Cheng Cheok <yccheok@yahoo.com>
Re: Primary Key Increment Doesn't Seem Correct Under Table Partition Alban Hertroys <dalroi@solfertje.student.utwente.nl>
On 26 Jan 2010, at 11:00, Yan Cheng Cheok wrote:

> However, whenever I insert row into measurement table, I realize its primary key value is going from 2, 4, 6, 8, 10...
> 
> May I know how can I prevent this?

Apparently nextval on that sequence gets called multiple times in your queries.

> Also, is it necessary to create index for measurement_id found in measurement's child table? I am concern on the read speed.


Serials don't create indexes, only a sequence. Primary keys create indexes (to guarantee uniqueness) - foreign keys do not.
So yes, you want an index on that column in the child table.

Alban Hertroys

--
Screwing up is the best way to attach something to the ceiling.


!DSPAM:737,4b5ec59910605107914066!


В списке pgsql-general по дате отправления
От: Yan Cheng Cheok
Дата:
От: A. Kretschmer
Дата:
FAQ