-
Full table scan and index scan issue
Hi Guys,
We have two database OPRODBUG and ODEV. The issue here is we need to identify why on ODEV the third query is going for full table scan where OPRODBUG going on index scan We are currently working on query performance this will help us in indentifying the issue.
There are 2 section 1) Count of rows on various query 2) Scan information for the respective query.
Note: The format below does not look good.
Query OPRODBUG ODEV
select count(*) from oe_order_lines_all; 1391168 1215425
select count(*) from oe_order_lines_all a where actual_shipment_date >= (sysdate -90); 8706 20
select count(*) from oe_order_lines_all a where actual_shipment_date >= (sysdate -2); 18 14
select count(*) from oe_order_lines_all; Full Table Scan Full Table Scan
select * from oe_order_lines_all where actual_shipment_date >= (sysdate -90); Full Table Scan Full Table Scan
select * from oe_order_lines_all where actual_shipment_date >= (sysdate -2); Index scan Full Table Scan
-
Look at row counts... data distribution is different - that's why.
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
did you check the stats on oe_order_lines_all table and the corresponding Indexes in OPRODBUG environment?
Thanks,
Vijay Tummala
Try hard to get what you like OR you will be forced to like what you get.
-
You can directly give the column name instead of using "*" in count function.
To get the exact total records count, you must use a non-null column in count fuction.
-
Originally Posted by BeefStu
You can directly give the column name instead of using "*" in count function.
To get the exact total records count, you must use a non-null column in count fuction.
Firstly, not sure why you are hijacking the thread with a totally out of the core topic post.
Secondly, why would you want to do that when you can do count(*)? if the answer is "performance" - prove it.
Last edited by PAVB; 09-26-2010 at 05:01 PM.
Reason: typo
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
Originally Posted by BeefStu
You can directly give the column name instead of using "*" in count function.
To get the exact total records count, you must use a non-null column in count fuction.
what a crap load of rubbish
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|