Skip site navigation (1) Skip section navigation (2)

Re: planner/optimizer question

From: "Atesz" <atesz(at)ritek(dot)hu>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: planner/optimizer question
Date: 2004-04-27 12:54:27
Message-ID: 002901c42c56$c8e077a0$0b02010a@atesz (view raw, whole thread or download thread mbox)
Lists: pgsql-performance

You should try the next queries:

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

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
SET enable_seqscan=0;
SET enable_sort = 0;

Regards, Antal Attila

In response to

pgsql-performance by date

Next:From: Christopher Kings-LynneDate: 2004-04-27 15:01:22
Subject: Re: [JDBC] [PERFORM] is a good practice to create an index on the
Previous:From: Manfred KoizarDate: 2004-04-27 12:12:20
Subject: Re: Shared buffers, Sort memory, Effective Cache Size

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group