Very long "or" where clause - Mailing list pgsql-general

From Scara Maccai
Subject Very long "or" where clause
Date
Msg-id 45AC9613.6030204@yahoo.it
Whole thread Raw
Responses Re: Very long "or" where clause
Re: Very long "or" where clause
List 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?





pgsql-general by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: [HACKERS] Checkpoint request failed on version 8.2.1.
Next
From: Florian Weimer
Date:
Subject: Re: Very long "or" where clause