Re: [SQL] which is better: using OR clauses or UNION?

2011-08-16 Thread adam_pgsql
On 16 Aug 2011, at 15:09, Tom Lane wrote: > adam_pgsql writes: >> I have a query hitting a table of 25 million rows. The table has a >> text field ('identifier') which i need to query for matching rows. The >> question is if i have multiple strings to match

Re: [SQL] which is better: using OR clauses or UNION?

2011-08-16 Thread adam_pgsql
xt_field)); > (taken from: http://archives.postgresql.org/pgsql-sql/2003-09/msg00395.php) > > > > > On Tue, Aug 16, 2011 at 1:39 PM, adam_pgsql wrote: > > Hi, > > I have a query hitting a table of 25 million rows. The table has a text field > ('ide

[SQL] which is better: using OR clauses or UNION?

2011-08-16 Thread adam_pgsql
Hi, I have a query hitting a table of 25 million rows. The table has a text field ('identifier') which i need to query for matching rows. The question is if i have multiple strings to match against this field I can use multiple OR sub-statements or multiple statements in a UNION. The UNION see