pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Teran <david.teran@cluster9.com>
Cc: Shridhar Daithankar <shridhar_daithankar@myrealbox.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: optimizing Postgres queries
Date: Mon, 05 Jan 2004 13:52:40 -0500
Message-ID: <16230.1073328760@sss.pgh.pa.us> (raw)
In-Reply-To: <9CC6A792-3FAF-11D8-A528-000A95A6F0DC@cluster9.com>
References: <4B0023AC-3F72-11D8-B3EB-000A95A6F0DC@cluster9.com>
	<200401051705.55120.shridhar_daithankar@myrealbox.com>
	<64C8DBBA-3F77-11D8-A528-000A95A6F0DC@cluster9.com>
	<200401051740.05006.shridhar_daithankar@myrealbox.com>
	<3796212E-3F79-11D8-A528-000A95A6F0DC@cluster9.com>
	<9966.1073316152@sss.pgh.pa.us>
	<9CC6A792-3FAF-11D8-A528-000A95A6F0DC@cluster9.com>

David Teran <david.teran@cluster9.com> writes:
> What we found out now is that a query with a single 'where' works fine, 
> the query planer uses the index but when we have 'two' where clauses it 
> does not use the index anymore:

> EXPLAIN ANALYZE SELECT columns...  FROM "KEY_VALUE_META_DATA" t0 WHERE 
> (t0."ID_VALUE" = 14542); performs fine, less than one millisecond.

> EXPLAIN ANALYZE SELECT columns...  FROM "KEY_VALUE_META_DATA" t0 WHERE 
> (t0."ID_VALUE" = 14542 OR t0."ID_VALUE" = 14550); performs bad: about 
> 235 milliseconds.

Please, when you ask this sort of question, show the EXPLAIN ANALYZE
output.  It is not a virtue to provide minimal information and see if
anyone can guess what's happening.

			regards, tom lane



view thread (17+ messages)  latest in thread

Message-ID: <16230.1073328760@sss.pgh.pa.us>
Permalink:  ../16230.1073328760@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16230.1073328760@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, david.teran@cluster9.com, shridhar_daithankar@myrealbox.com
  Subject: Re: optimizing Postgres queries
  In-Reply-To: <16230.1073328760@sss.pgh.pa.us>

* 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