473,473 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Access plan question

Hi,

When I explain the following SQL, the optimizer conjures up two columns
$C0 and $C1. It appears that they might refer to min and max values for
the range of values returned by the sub-select. Is that correct?

From the access plan graph it appears that, SIEBEL.S_EVT_ACT is the
first table to get accessed, before the sub-select is evaluated. If I
interpreted the graph correctly, I don't see how optimizer can determine
$C0 and $C1 before accessing the SIEBEL.EIM_ACTIVITY table which is in
the sub-select?

TIA

P Adhia
Original Statement:
------------------
SELECT 'touch'
FROM siebel.S_EVT_ACT
WHERE (ROW_ID IN
(SELECT T_ACT_EMP_ACTIVI
FROM siebel.EIM_ACTIVITY
WHERE (IF_ROW_BATCH_NUM = 501 AND T_ACT_EMP__EXS = 'N' AND
T_ACT_EMP__STA
= 0 AND T_ACT_EMP__UNQ = 'Y' AND IF_ROW_STAT_NUM = 0)))
FOR UPDATE
Optimized Statement:
-------------------
SELECT 'touch'
FROM SIEBEL.S_EVT_ACT AS Q3
WHERE (Q3.ROW_ID <= $C1) AND (Q3.ROW_ID >= $C0) AND Q3.ROW_ID = ANY
(SELECT DISTINCT Q1.T_ACT_EMP_ACTIVI, $C0, $C1
FROM SIEBEL.EIM_ACTIVITY AS Q1
WHERE (Q1.IF_ROW_STAT_NUM = +0000000000.) AND (Q1.T_ACT_EMP__UNQ = 'Y')
AND (Q1.T_ACT_EMP__STA = +0000000000.) AND (Q1.T_ACT_EMP__EXS =
'N') AND (Q1.IF_ROW_BATCH_NUM = +000000000000501.)
ORDER BY Q1.T_ACT_EMP_ACTIVI)

Access Plan:
-----------
Total Cost: 46898.9
Query Degree: 1

Rows
RETURN
( 1)
Cost
I/O
|
2477.66
FETCH
( 2)
46898.9
3626.87
/---+---\
2477.66 8.62797e+007
TBSCAN TABLE: SIEBEL
( 3) S_EVT_ACT
14650.7
1118.51
|
2477.66
TEMP
( 4)
14648.1
1118.51
|
2477.66
FETCH
( 5)
14646.8
1118.51
+------------+------------+
4955.33 1 8.62797e+007
IXSCAN TBSCAN TABLE: SIEBEL
( 6) ( 7) S_EVT_ACT
77.8267 12.9039
5.75398 1
| |
8.62797e+007 1
INDEX: SIEBEL TEMP
S_EVT_ACT_P1 ( 8)
12.8886
1
|
1
UNIQUE
( 9)
12.883
1
|
1
IXSCAN
( 10)
12.8829
1
|
78750
INDEX: SIEBEL
EIM_ACTIVITY_PA7
Sep 29 '06 #1
2 2202
Try this,

SELECT 'touch'
FROM siebel.S_EVT_ACT
WHERE ROW_ID =
(SELECT ROW_ID
FROM siebel.S_EVT_ACT
INTERSECT
SELECT T_ACT_EMP_ACTIVI
FROM FROM siebel.EIM_ACTIVITY
WHERE IF_ROW_BATCH_NUM = 501
AND T_ACT_EMP__EXS = 'N'
AND T_ACT_EMP__STA = 0
AND T_ACT_EMP__UNQ = 'Y'
AND IF_ROW_STAT_NUM = 0)
P Adhia wrote:
Hi,

When I explain the following SQL, the optimizer conjures up two columns
$C0 and $C1. It appears that they might refer to min and max values for
the range of values returned by the sub-select. Is that correct?

From the access plan graph it appears that, SIEBEL.S_EVT_ACT is the
first table to get accessed, before the sub-select is evaluated. If I
interpreted the graph correctly, I don't see how optimizer can determine
$C0 and $C1 before accessing the SIEBEL.EIM_ACTIVITY table which is in
the sub-select?

TIA

P Adhia
Original Statement:
------------------
SELECT 'touch'
FROM siebel.S_EVT_ACT
WHERE (ROW_ID IN
(SELECT T_ACT_EMP_ACTIVI
FROM siebel.EIM_ACTIVITY
WHERE (IF_ROW_BATCH_NUM = 501 AND T_ACT_EMP__EXS = 'N' AND
T_ACT_EMP__STA
= 0 AND T_ACT_EMP__UNQ = 'Y' AND IF_ROW_STAT_NUM = 0)))
FOR UPDATE
Optimized Statement:
-------------------
SELECT 'touch'
FROM SIEBEL.S_EVT_ACT AS Q3
WHERE (Q3.ROW_ID <= $C1) AND (Q3.ROW_ID >= $C0) AND Q3.ROW_ID = ANY
(SELECT DISTINCT Q1.T_ACT_EMP_ACTIVI, $C0, $C1
FROM SIEBEL.EIM_ACTIVITY AS Q1
WHERE (Q1.IF_ROW_STAT_NUM = +0000000000.) AND (Q1.T_ACT_EMP__UNQ = 'Y')
AND (Q1.T_ACT_EMP__STA = +0000000000.) AND (Q1.T_ACT_EMP__EXS =
'N') AND (Q1.IF_ROW_BATCH_NUM = +000000000000501.)
ORDER BY Q1.T_ACT_EMP_ACTIVI)

Access Plan:
-----------
Total Cost: 46898.9
Query Degree: 1

Rows
RETURN
( 1)
Cost
I/O
|
2477.66
FETCH
( 2)
46898.9
3626.87
/---+---\
2477.66 8.62797e+007
TBSCAN TABLE: SIEBEL
( 3) S_EVT_ACT
14650.7
1118.51
|
2477.66
TEMP
( 4)
14648.1
1118.51
|
2477.66
FETCH
( 5)
14646.8
1118.51
+------------+------------+
4955.33 1 8.62797e+007
IXSCAN TBSCAN TABLE: SIEBEL
( 6) ( 7) S_EVT_ACT
77.8267 12.9039
5.75398 1
| |
8.62797e+007 1
INDEX: SIEBEL TEMP
S_EVT_ACT_P1 ( 8)
12.8886
1
|
1
UNIQUE
( 9)
12.883
1
|
1
IXSCAN
( 10)
12.8829
1
|
78750
INDEX: SIEBEL
EIM_ACTIVITY_PA7
Sep 29 '06 #2
ji*****@gmail.com wrote:
Try this,

SELECT 'touch'
FROM siebel.S_EVT_ACT
WHERE ROW_ID =
(SELECT ROW_ID
FROM siebel.S_EVT_ACT
INTERSECT
SELECT T_ACT_EMP_ACTIVI
FROM FROM siebel.EIM_ACTIVITY
WHERE IF_ROW_BATCH_NUM = 501
AND T_ACT_EMP__EXS = 'N'
AND T_ACT_EMP__STA = 0
AND T_ACT_EMP__UNQ = 'Y'
AND IF_ROW_STAT_NUM = 0)
Thanks for the suggestion. I wasn't looking to get an alternative SQL.
I just wanted to understand how to interpret the access plan.

Reading from left to right and bottom to up, I couldn't figure out how
can stream which is on left of an operator (FETCH) can receive input
from and depend on a stream which is on the right. Also, I can't say I
have seen FETCH operator with 3 input streams before. I know only the
most common variant, that is, FETCH operator used for indexed access to
table.

P Adhia

PS Although, I can't change the SQL, but if I could, why do you think
your version of the SQL is better? Do you think DB2 optimizer will
select a better access path?

Sep 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
2
by: Fan Ruo Xin | last post by:
Can someone help me to confirm - From the access plan tree of a query, if one table is referred (TABLE SCAN) three times. Does that mean this table was scanned (either from disk or bufferpool)...
5
by: sql-db2-dba | last post by:
We have DB2 UDB v8.1 fixpak3 on AIX 5. Production and Development configuarations (at least for DB2) are identical albeit production is a 2-way server while development has only one processor....
22
by: Marc Mones | last post by:
Hello, I'working with IBM DB2 V8.1 and CLI/ODBC. I've got a problem with the following statement: ******************************************************************************** SELECT...
6
by: UDBDBA | last post by:
All: We are running UDB V8.2 FP8. We have sql query which uses DGTT. The access plan for the query changes based on rows selected into DGTT. 1. Secnario I: DGTT has atlest 1 row. I see INDEX...
4
by: Vincent Yang | last post by:
I'm using Access 2002. My database is in Access 2000 format. I'm designing a form to collect responses to a 40-item questionnaire. I can fit four list boxes on a screen, so I plan to have 11 tab...
6
by: Jack Orenstein | last post by:
Suppose I have a table as follows: testdb=> \d person Table "public.person" Column | Type | Modifiers ------------+-------------------------+----------- id |...
5
by: mathieu.page | last post by:
Hi, I often have recursives queries in my applications, like in this simplified example : req1 : SELECT EmployeNo, EmployeName, EmployePhone FROM Employe; req2 :
2
by: HeMan_Speaks | last post by:
I m currently developing a java based application and want to know how can i make client access database located on the server?
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
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
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...
1
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
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.