Re: Column order in multi column primary key

Поиск
Список
Период
Сортировка
Искать
От
David G. Johnston
Тема
Re: Column order in multi column primary key
Дата
Msg-id
CAKFQuwa0Bso+3tDXJiHwBzNqg9PsFu0yD0yM=FW84z1=4Gab9A@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Column order in multi column primary key "Craig Boucher" <craig@wesvic.com>
Re: Column order in multi column primary key "David G. Johnston" <david.g.johnston@gmail.com>
Re: Column order in multi column primary key "Craig Boucher" <craig@wesvic.com>
Re: Column order in multi column primary key "David G. Johnston" <david.g.johnston@gmail.com>
Re: Column order in multi column primary key "Craig Boucher" <craig@wesvic.com>
Re: Column order in multi column primary key Tom Lane <tgl@sss.pgh.pa.us>
Re: Column order in multi column primary key "Craig Boucher" <craig@wesvic.com>
Re: Column order in multi column primary key Kevin Grittner <kgrittn@gmail.com>
Re: Column order in multi column primary key "Craig Boucher" <craig@wesvic.com>
Re: Column order in multi column primary key Kevin Grittner <kgrittn@gmail.com>
Re: Column order in multi column primary key "David G. Johnston" <david.g.johnston@gmail.com>
On Mon, Aug 8, 2016 at 4:35 PM, Craig Boucher <craig@wesvic.com> wrote:

Thanks David.  I’ve thought about the hierarchy you mentioned but the hierarchy can change and I need to capture it as it was when the data was generated.

 

I should have pointed out in my last response that I was wondering if the performance of the pk index on work_session would be better if my primary key was (customer_id, work_session_id) or if (work_session_id,  customer_id) will be fine.  Customer_id will be repeated quite a bit in the table but work_session_id should be unique across the whole table.

 


​I answered that in the original response...for PKs to operate most efficiently the most selective attribute ​should come first.

David J.
В списке pgsql-general по дате отправления
От: Craig Boucher
Дата:
От: Tom Lane
Дата:
FAQ