WHERE clause with 40+ conditions

From: DrYSG <ygutfreund(at)draper(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: WHERE clause with 40+ conditions
Date: 2012-05-04 18:31:51
Message-ID: 1336156311624-5686659.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

My users are presented with a list of checkbox for 4 different attributes
(e.g. type of image, country, etc.)

For type of image they can choose JPG, PNG, JP2000, etc. or turn off the
check box.

My naive implementation would have a WHERE clause with over 40 different
tests (type='JPG' OR type='PNG' OR country='USA' ...)

There has to be an more efficient way to do this (and gives better hints to
the PLANNER).

Suggestions?

--
View this message in context: http://postgresql.1045698.n5.nabble.com/WHERE-clause-with-40-conditions-tp5686659.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Binand Sethumadhavan 2012-05-05 09:07:50 Re: WHERE clause with 40+ conditions
Previous Message Tom Lane 2012-05-04 13:55:24 Re: Import CSV with Dates & Times