DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: Full table scan and index scan issue

  1. #1
    Join Date
    Mar 2010
    Location
    Los Angeles
    Posts
    20

    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

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    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.

  3. #3
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865
    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.

  4. #4
    Join Date
    Jul 2006
    Posts
    195
    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.

  5. #5
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Quote Originally Posted by BeefStu View Post
    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.

  6. #6
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    Quote Originally Posted by BeefStu View Post
    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
  •  


Click Here to Expand Forum to Full Width