By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,589 Members | 2,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,589 IT Pros & Developers. It's quick & easy.

Why OR extremely slows down the query?

P: 1
I have a query, which takes about 4 seconds to execute
Expand|Select|Wrap|Line Numbers
  2. FROM wq, wq_xml
  3. WHERE =
  4. AND wq.type = 2
  5. AND SUBSTR(wq_xml.xml_data, POSSTR(SUBSTR(wq_xml.xml_data, 1, 200), 'bagmeGd=') IN ('41', '42', '43', '44', '45', '47')
  6. AND state = 91
If I change the last row to AND (state = 91 OR state = 93) it takes more than 10 minutes to execute. What is wrong with this query?
I have DB2 v. installed on Win XPSP2 machine
Sep 18 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 297
Hi Ovartomortes,

use the DB2 explain function ( ). It shows you graphically how DB2 is working on a statement, if/how it's using indexes, joining tables etc. It will show you the difference you're looking for.

You also might try "AND state in (91,93)" and see the influence.

Regards, Bernd
Sep 18 '07 #2

Post your reply

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