Does it matters the column order in indexes and constraints creation?

Поиск
Список
Период
Сортировка
От Arnau
Тема Does it matters the column order in indexes and constraints creation?
Дата
Msg-id 45A617F2.6040802@andromeiberica.com
обсуждение исходный текст
Ответы Re: Does it matters the column order in indexes and constraints
Список pgsql-performance
Hi all,

   I've got a doubt about how to create an index and a primary key. Lets
say I have the following table:

   CREATE TABLE blacklist
   (
     telephone    VARCHAR(15),
     customer_id    INT4
                  CONSTRAINT fk_blacklist_customerid REFERENCES
                    customers( customer_id ),
     country_id     INT2
                  CONSTRAINT fk_blacklist_countryid REFERENCES
                    countries( country_id ),
                  CONSTRAINT pk_blacklist_cidcustidtel
                    PRIMARY KEY(country_id, customer_id, telephone)
   );

   The country_id column can have maybe 100 - 250 different values.
   The customer_id column can have as much several hundred values (less
than 1000).
   The telephone is where all will be different.

   So my doubt is, in terms of performance makes any difference the
order of the primary key fields? The same in the index definition? I
have checked the postgresql documentation I haven't been able to find
anything about.

Thanks
--
Arnau

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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: High inserts, bulk deletes - autovacuum vs scheduled vacuum
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Does it matters the column order in indexes and constraints