Re: Select too many ids..

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: Abandoned <besturk(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Select too many ids..
Date: 2007-10-02 16:31:28
Message-ID: dcc563d10710020931h55236a58wb8068cca8fa7a7fe@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/1/07, Abandoned <besturk(at)gmail(dot)com> wrote:
> Hi..
> I have a id list and id list have 2 million dinamic elements..
> I want to select what id have point..
> I try:
>
> SELECT id, point FROM table WHERE id in (IDLIST)
>
> This is working but too slowly and i need to performance..
>
> I'm sorry my bad english.
> King regards..

Try adding another bit of where clause:

SELECT id, point FROM table WHERE id in (IDLIST) and point is not null

it may be faster with a partial index " on table(id) where point is
null " or something like that.

What does explain / explain analyze say about the query?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rodrigo De León 2007-10-02 16:31:42 Re: Select too many ids..
Previous Message Ottavio Campana 2007-10-02 16:30:29 create visual query in web applications