Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Where Clauses: IN versus =
I'm writing a lot of code in a various apps to construct strings which
are Oracle SQL statements.
I'm wondering if there is a performance hit with the use of in() versus equals. I know for multiple criteria that, for example:
Where FK_Whatever in (123, 124, 16, 4)
is preferable to:
Where FK_Whatever = 123 or FK_Whatever = 124 or FK_Whatever = 16 or FK_Whatever = 4
But what about when I have a single criteria? Is:
Where FK_Whatever = 123
faster/preferable to
Where FK_Whatever in (123)?
The reason I ask is because it is much easier to simply write the code to construct an in() rather than test to see how many criteria there are. I can and have done the latter for years, but wonder if I am just wasting my efforts.
Any comment is appreciated, thanks very much in advance.
-- Tim http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - MeReceived on Mon Sep 12 2005 - 10:31:14 CDT
![]() |
![]() |