pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: FavoYang@gmail.com
To: pgsql-sql@postgresql.org
Subject: slow 'IN' clause
Date: 9 Apr 2006 20:44:34 -0700
Message-ID: <1144640674.181974.108190@u72g2000cwu.googlegroups.com> (raw)

I have a slow sql:
SELECT * FROM mytable WHERE id IN (1,3,5,7,....3k here...);
mytable is about 10k rows.

if don't use the "IN" clause, it will cost 0,11 second, otherwise it
will cost 2.x second
I guess pg use linear search to deal with IN clause, is there any way
to let pg use other search method with IN clause? (ex.Binary Search or
hash Search)




view thread (2+ messages)  latest in thread

Message-ID: <1144640674.181974.108190@u72g2000cwu.googlegroups.com>
Permalink:  ../1144640674.181974.108190@u72g2000cwu.googlegroups.com/
Also on:    postgresql.org/message-id/1144640674.181974.108190@u72g2000cwu.googlegroups.com

 · 

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-sql@postgresql.org
  Cc: FavoYang@gmail.com
  Subject: Re: slow 'IN' clause
  In-Reply-To: <1144640674.181974.108190@u72g2000cwu.googlegroups.com>

* 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