473,404 Members | 2,195 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,404 software developers and data experts.

Differing query results based on access path

Hello Guys,

Am posting two queries here which are exactly same except for an always false condition( 0 = 1) to influence the access path selection, to my surprise i am getting 183 records if the query goes for a table space scan and the number of records fetched is 0 if the index scan happens. I am running the query in DB2 V8 for Z/OS. This is totally baffling as the option of adding a false condition is one of the tuning option suggested at so many place. Any justification for this behaviour would help us greatly.

Query 1 (No Records)

EN_ID FOR TABLE NFM.VWNFM_ENAME IS HAVING A INDEX AND THAT IS BEING USED IN THIS QUERY

SELECT *
FROM
NFM.VWNFM_ENAME A,
NFM.VWNFM_RLE B,
EFM.VWEFM_XEF D
LEFT OUTER JOIN
NFM.VWNFM_ARESS C
ON (D.CR_EN_ID_CD = C.EN_ID
AND C.AD_TPE = 'OC')
WHERE
B.CR_EN_ID_CD = D.CR_EN_ID_CD
AND D.EN_ID_CD = 'DIGRO'
AND D.RC_ST_CD = '1'
AND A.EN_ID = D.CR_EN_ID_CD
AND
A.EN_ID IN
(SELECT DISTINCT AT_MN_ID FROM
EFM.VWEFM_ET_RSP
WHERE RSP_TPE_CD = 'HNG' )

Query 2 (183 Records output)

EN_ID FOR TABLE NFM.VWNFM_ENAME IS HAVING A INDEX AND THAT IS BEING AVOIDED BY PUTTING A OR CLAUSE HENCE FORCING A TABLESPACE SCAN

SELECT *
FROM
NFM.VWNFM_ENAME A,
NFM.VWNFM_RLE B,
EFM.VWEFM_XEF D
LEFT OUTER JOIN
NFM.VWNFM_ARESS C
ON (D.CR_EN_ID_CD = C.EN_ID
AND C.AD_TPE = 'OC')
WHERE
B.CR_EN_ID_CD = D.CR_EN_ID_CD
AND D.EN_ID_CD = 'DIGRO'
AND D.RC_ST_CD = '1'
AND A.EN_ID = D.CR_EN_ID_CD
AND ( 0 = 1 OR
A.EN_ID IN
(SELECT DISTINCT AT_MN_ID FROM
EFM.VWEFM_ET_RSP
WHERE RSP_TPE_CD = 'HNG' ) )
Jun 12 '07 #1
0 1068

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

Similar topics

14
by: CJM | last post by:
I have a query which produces different results in the Access query builder and in an ASP page (via ADO) An example of the query is: ----------------------------------------------------------...
7
by: vnl | last post by:
I'm trying to run a SQL query but can't find any records when trying to select a certain date. Here's the sql: SELECT field 1, field2, date_and_time, FROM table1 WHERE date_and_time =...
3
by: cassandra.flowers | last post by:
Hi, I was wondering if it is possible (Using access) to have a query parameter as a drop down box rather than a text box? e.g. typing as criteria for a query produces a box with a text box...
3
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to...
1
by: Robert | last post by:
I am trying to create a db for service providers by county. I'm relatively new to db programming, but I have done quite a bit of programming ranging from the old basic days up to doing some...
6
by: Brian | last post by:
Hello, Basically, I'm running a query on a form's activation, and I'd like to have the results of the query be placed into other fields on the same form automatically. Does anybody know how...
3
by: Bill Hutchison | last post by:
I have a query that returns different results (3508 rows for snapshot, 6288 for dynaset) and that is the only thing I change to get the different results. When I try to make a table from the...
4
by: dancole42 | last post by:
So I have an invoicing database based on two main forms: Orders and OrderLines. Orders has fields like: OrderID BillingMethod OrderDate CreditCard CCExp OrdSubTotal ShippingCharge
12
by: TARHEELS721 | last post by:
I am trying to send the results of a query that runs when I click a button on my form that is based on a parameter query. The code runs without any errors but nothing is exported into my excel...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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.