What order in primary key definition ?

Поиск
Список
Период
Сортировка
От franck.routier@axege.com
Тема What order in primary key definition ?
Дата
Msg-id 1199.155.105.90.173.1153982791.squirrel@155.105.90.173
обсуждение исходный текст
Ответы Re: What order in primary key definition ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Hi,

I am wondering if the order in which primary key fields are ordered has an
impact on performance...

If my primary key has, say, two fields, my spontaneous guess would be to
put them from the most general to the most specific :

primary key ( generalKey, specificKey)

generalKey may have 2 to 10 different values in the table (say it is a
society identifier in an accounting software for example). SpecificKey, on
the contrary, might have 100 to 1000 different values (say it is the
account identifier for example).

But on second thought, I wonder if it would be better to define primary
key (specificKey, genericKey) as it could make index access more
discriminent.

Is this the way to go ?

Thanks,
Franck


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_dump : Mysterious"-b" switch
Следующее
От: "roy simkes"
Дата:
Сообщение: PostgreSQL Replication