Very long "or" where clause

From: Scara Maccai <m_lists(at)yahoo(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Very long "or" where clause
Date: 2007-01-16 09:08:35
Message-ID: 45AC9613.6030204@yahoo.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
from a table with 100,000,000 rows I have to sum some records using a
query like:

select sum(field1) from mytab where
(time = 1 and id = 3)
or
(time = 3 and id = 1)
or
(time = 2 and id = 5)
[...]

The "or clauses" can be even 10,000,000...
Which would be the best method to access data? Should I use a procedure
on the server side?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2007-01-16 09:14:26 Re: [HACKERS] Checkpoint request failed on version 8.2.1.
Previous Message Tom Lane 2007-01-16 05:29:22 Re: [HACKERS] Checkpoint request failed on version 8.2.1.