Re: TimeOf(Subselects|Joins)FromLargeTables?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dann Corbit" <DCorbit(at)connx(dot)com>
Cc: "Hegedus, Tamas (dot)" <Hegedus(dot)Tamas(at)mayo(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: TimeOf(Subselects|Joins)FromLargeTables?
Date: 2004-06-05 04:55:53
Message-ID: 15079.1086411353@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Dann Corbit" <DCorbit(at)connx(dot)com> writes:
> I think ... an in-list is going to do better than a list of constants
> separated by OR.

Right at the moment, there is no performance difference between
WHERE foo IN (const1, const2, const3)
and
WHERE foo = const1 OR foo = const2 OR foo = const3
because in fact the parser expands the former into the latter at
a pretty early stage.

Still, I'd suggest using the IN form when you can. It's more
concise, arguably less prone to typos, and someday we might even
implement it more efficiently than the other form.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-06-05 04:57:42 Re: [HACKERS] pg_dump --comment?
Previous Message Lamar Owen 2004-06-05 03:48:59 Re: Official Freeze Date for 7.5: July 1st, 2004