Re: planner/optimizer question

Поиск
Список
Период
Сортировка
От Atesz
Тема Re: planner/optimizer question
Дата
Msg-id 002901c42c56$c8e077a0$0b02010a@atesz
обсуждение исходный текст
Ответ на planner/optimizer question  (brad-pgperf@duttonbros.com)
Список pgsql-performance
Hi,

You should try the next queries:

select support_person_id from ticket_crm_map where crm_id = 7 GROUP BY
support_person_id;
select support_person_id from ticket_crm_map where crm_id = 1 GROUP BY
support_person_id;

It can use the 'ticket_crm_map_crm_id_suppid' index.

Generally the Postgres use an k-column index if columns of your
conditions are prefix of the index column.
For example:
CREATE INDEX test_idx on test(col1,col2,col3,col4);
SELECT * FROM test WHERE col1=3 AND col2=13;  -- This can use the index.

But the next queries cannot use the index:
SELECT * FROM test WHERE col1=3 AND col3=13;.
SELECT * FROM test WHERE col2=3;

If you have problem with seq_scan or sort, you can disable globally and
locally:
SET enable_seqscan=0;
SET enable_sort = 0;

Regards, Antal Attila



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

Предыдущее
От: Manfred Koizar
Дата:
Сообщение: Re: Shared buffers, Sort memory, Effective Cache Size
Следующее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: [JDBC] is a good practice to create an index on the