473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

performance degrades if one argument in "In Clause" ?

I like to know if the following makes any performance issue.

select field_1 from table_1 where country ='USA';
(or)
select field_1 from table_1 where country in ('USA');

The reason behind is:

(a) For some scenario, country can only be 'USA'.
(b) And for some other, country can be 'USA' or 'EUR' or 'AUS'.

So, I am in a fix where i can use "In" clause in (a), so that my dynamic query becomes simpler and generic for both (a) and (b). Otherwise, if having one argument in "IN" clause degrades the performance, then i have to make for two dynamic queries, one using equality and another using "IN".

Appreciate your comments on this.
Jun 14 '07 #1
1 1807
michaelb
534 Expert 512MB
I like to know if the following makes any performance issue.

select field_1 from table_1 where country ='USA';
(or)
select field_1 from table_1 where country in ('USA');
Chances are the query optimizer converts "where country in ('USA')" into "where country = 'USA'" anyway.
In any case you can probably use the EXPLAIN on your query to get this and other performance related information.
Jun 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Olaf Meding | last post by:
What does the below PyChecker warning mean? More importantly, is there a way to suppress it? PyChecker warning: ..\src\phaseid\integration.py:21: self is argument in staticmethod My best...
1
by: Tamer Higazi | last post by:
Hi! I have problems creating joins between tables and to limit rows for a specified clolumn. I have 2 tables! employees departments I face the problems with the GROUP BY clause and i don't...
6
by: Gary N. | last post by:
Hi - I'm not sure if I've found a bug with the "splice" function or if I just need better documentation. Splice doesn't work quite how O'Reilly describes it (Javascript, 4th edition, Jan 2002,...
3
by: karthik | last post by:
Does anybody know what is the limit for the number of values one can have in a list of expressions (to test for a match) for the IN clause? For example, SELECT au_lname, state FROM authors...
4
by: Jacinle Young | last post by:
Hi all, I have written the SQL but it doesn't work db2 "select acode from t1 where (acode) not in (select eid from t2 where iid ='0') and iid ='0'" select nothing but the following works
5
by: davehansen22 | last post by:
Is there a way to generate a MySQL WHERE clause from a search string like this: "(dave OR hansen) php programmer" I would want to use the generated MySQL clause against a "memo" type field. ...
0
NeoPa
by: NeoPa | last post by:
Intention : To prepare a WHERE clause for multiple field selection, but to ignore any fields where the selection criteria are not set. ONLY WORKS WITH TEXT FIELD SELECTIONS. Scenario : You have...
4
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in...
350
by: Lloyd Bonafide | last post by:
I followed a link to James Kanze's web site in another thread and was surprised to read this comment by a link to a GC: "I can't imagine writing C++ without it" How many of you c.l.c++'ers use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.