pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Atesz <atesz@ritek.hu>
To: pgsql-performance@postgresql.org
Subject: Re: planner/optimizer question
Date: Tue, 27 Apr 2004 14:54:27 +0200
Message-ID: <002901c42c56$c8e077a0$0b02010a@atesz> (raw)
In-Reply-To: <20040426171103.45600.qmail@uno.mnl.com>

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





view thread (37+ messages)  latest in thread

Message-ID: <002901c42c56$c8e077a0$0b02010a@atesz>
Permalink:  ../002901c42c56$c8e077a0$0b02010a@atesz/
Also on:    postgresql.org/message-id/002901c42c56$c8e077a0$0b02010a@atesz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: atesz@ritek.hu
  Subject: Re: planner/optimizer question
  In-Reply-To: <002901c42c56$c8e077a0$0b02010a@atesz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox