Search Postgresql Archives

Re: Select too many ids..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rodrigo De León wrote:
> On 10/1/07, Abandoned <besturk@xxxxxxxxx> 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..
> 
> DDL please...

I guess the OP's problem is with the time it takes to push a query
containing 2 million ID's through the SQL parser.

A few things that may help:

- See if you can find any uninterrupted ranges of values in your ID's
and combine them into separate where clauses (ie. where id between x and
y). This won't help you much for ranges where y = x+1, but it does help
if (for example) y = x+10...

- Try if it helps COPY-ing your ID's into a temp table and join your
table with that instead of using a huge IN list.

- If you're still using PG 7.4, try a PG 8. There have been significant
performance improvements with IN lists in queries in the 8-series.

Regards,

-- 
Alban Hertroys
a.hertroys@xxxxxxxxxxxxxxxxx

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux