473,394 Members | 1,658 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,394 software developers and data experts.

Explain Plan returns only one index usage

Here is the scenario:
1. IEHP003_Chk_Result (EHP003_Check_Result_Log_K) - Primary Key - 500,000 rows
2. IEHP005_Violation (EHP003_Check_Result_Log_K) - Primary Key -
550,000 rows
3.Non Unique index available in EHP001_DEVICE_N, EHP003_Security_Condition_C,EHP004_Check_C
4.o_device_list,o_check_list,o_violtn_list,o_wrkfl w_list are Table Type with list of Values( More than 1000 values so i cant use it in 'IN' Parameter) from Java Screen List box.


Open o_check_cnt For
Select Chk_Result.EHP004_Check_C,
Count(Chk_Result.EHP003_Check_Result_Log_K) Cnt
From IEHP003_Chk_Result Chk_Result,
IEHP005_Violation Violtn,
Table (o_device_list) Dev,
Table (o_check_list) Chk,
Table (o_violtn_list) Vstat,
Table (o_wrkflw_list) Wstat
Where Chk_Result.EHP003_Check_Result_Log_K = Violtn.EHP003_Check_Result_Log_K
And Chk_Result.EHP004_Check_C = Chk.l_check_name
And Chk_Result.EHP001_Device_N = Dev.l_device_name
And Chk_Result.EHP003_Security_Condition_C = 'FAIL'
And Violtn.EHPL07_Violation_Status_C = Vstat.l_violation_status
And Violtn.EHPL06_Workflow_Status_C = Wstat.l_workflow_status
And Chk_Result.EHP003_Last_Run_S Between NVL(i_start_date,'01-JAN-0001')
And NVL(i_end_date,'31-DEC-9999')
Group By Chk_Result.EHP004_Check_C;

This query is always using index on IEHP003_Chk_Result and not on IEHP005_violation
Feb 14 '06 #1
1 2395
Here is the scenario:
1. IEHP003_Chk_Result (EHP003_Check_Result_Log_K) - Primary Key - 500,000 rows
2. IEHP005_Violation (EHP003_Check_Result_Log_K) - Primary Key -
550,000 rows
3.Non Unique index available in EHP001_DEVICE_N, EHP003_Security_Condition_C,EHP004_Check_C
4.o_device_list,o_check_list,o_violtn_list,o_wrkfl w_list are Table Type with list of Values( More than 1000 values so i cant use it in 'IN' Parameter) from Java Screen List box.


Open o_check_cnt For
Select Chk_Result.EHP004_Check_C,
Count(Chk_Result.EHP003_Check_Result_Log_K) Cnt
From IEHP003_Chk_Result Chk_Result,
IEHP005_Violation Violtn,
Table (o_device_list) Dev,
Table (o_check_list) Chk,
Table (o_violtn_list) Vstat,
Table (o_wrkflw_list) Wstat
Where Chk_Result.EHP003_Check_Result_Log_K = Violtn.EHP003_Check_Result_Log_K
And Chk_Result.EHP004_Check_C = Chk.l_check_name
And Chk_Result.EHP001_Device_N = Dev.l_device_name
And Chk_Result.EHP003_Security_Condition_C = 'FAIL'
And Violtn.EHPL07_Violation_Status_C = Vstat.l_violation_status
And Violtn.EHPL06_Workflow_Status_C = Wstat.l_workflow_status
And Chk_Result.EHP003_Last_Run_S Between NVL(i_start_date,'01-JAN-0001')
And NVL(i_end_date,'31-DEC-9999')
Group By Chk_Result.EHP004_Check_C;

This query is always using index on IEHP003_Chk_Result and not on IEHP005_violation
This may be possible due to using the nested table in the join. You can use the CAST and then the DYNAMIC_SAMPLING hint to override this behaviour
Jun 8 '07 #2

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

Similar topics

10
by: Greg Stark | last post by:
This query is odd, it seems to be taking over a second according to my log_duration logs and according to psql's \timing numbers. However explain analyze says it's running in about a third of a...
3
by: Mark Harrison | last post by:
I have indexed two columns in a table. Can somebody explain to me why the first query below uses an Index Scan while the second uses a Seq Scan? Many TIA! Mark planb=# \d abcs Table...
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: marklawford | last post by:
Not having earned my DBA badge from the scouts just yet I'm a little lost with an error I'm getting. We've just upgraded our development database from 7.2 to 8.2 as the first step in upgrading...
0
by: JAW | last post by:
This plan seems like it should perform well. Does anyone see anything. SQL Statement Text: DECLARE MTR - RDG - EST - CSR CURSOR FOR
5
by: kabotnet | last post by:
Hi, I'm new in db2, I'm trying to execute EXPLAIN command on some queries but i have error like: And message similar to: Token EXPLAIN is not valid, valid tokens ( END GET SET CALL DROP FREE...
7
by: skaushik | last post by:
Hi all, I was working on a SQL query where a history table is joined with a small table to get some information. There is an index on the history table column but the explain plan tells that there...
0
by: db2admin | last post by:
hello, I have compressed table 442992 rows and when i run explain plan on this table for some SQL using this table, i see table scan and cardinality on top of table node as 18458. I am new to...
0
by: LanaR | last post by:
Hello, one sql statement is causing severe performance issue. The problem occurs only in UDB environment, the same statemnt on the mainframe is running fine. I have an explain output from the sql....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...

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.