Simple Query in Oracle Linked Table in MS Access causes full table scan.

I am running a very simple query in MS ACCESS to a linked Oracle table as follows:
Select *
From EXPRESS_SERVICE_EVENTS --(the linked table name refers to EXPRESS.SERVICE_EVENTS)
Where performed > MyDate()
or
Select *
From EXPRESS_SERVICE_EVENTS --(the linked table name refers to EXPRESS.SERVICE_EVENTS)
Where performed > [Forms]![MyForm]![Date1]
We have over 50 machines and this query runs fine on over half of these, using an Oracle Index on the "performed" field. Running exactly the same thing on the other machines causes a full table scan, therefore ignoring the Index (all machines access the same Access DB).
Strangely, if we write the query as follows:
Select *
From EXPRESS_SERVICE_EVENTS
Where performed > #09/04/2009 08:00#
it works fast everywhere!
Any help on this 'phenominon' would be appreciated.
Things we've done:
Checked regional settings, ODBC driver settings, MS Access settings (as in Tools->Options), we have the latest XP and Office service packs, and re-linked all Access Tables on both the slow and fast machines independantly).

Primarily, thanks gdarling for your reply. This solved our problem.
Just a small note to those who may be using this thread.
Although this might not be the reason, my PC had Oracle 9iR2 installed with Administratiev Tools, where user machines had the same thing installed but using Runtime Installation. For some reason, my PC did not have 'bind date' etc. as an option in the workarounds, but user machines did have this workaround option. Strangely, although I did not have the option, my (ODBC) query was running as expected, but user queries were not.
When we set the workaround checkbox accordingly, the queries then run as expected (fast).
Once again,
Thanks

Similar Messages

  • Finding the Text of SQL Query causing Full Table Scans

    Hi,
    does anyone have a sql script, that shows the complete sql text of queries that have caused a full table scan?
    Please also let me know as to how soon this script needs to be run, in the sense does it work only while the query is running or would it work once it completes (if so is there a valid duration, such as until next restart, etc.)
    Your help is appreciated.
    Thx,
    Mayuran

    Finding the Text of SQL Query Causing Full Table Scan

  • How to run simple query on oracle 11.2.0 ?

    hi
    i installed oracle 11.2.0 64bit on my Windows-7 64bit
    how i can connect and run any query on oracle ?
    what are the default tools that came with the installation and how to use it ?
    i sow in the forum that people write
    sql> select * from myTable ........
    how to get to this ?
    thanks in advance

    user1036207 wrote:
    hi
    i installed oracle 11.2.0 64bit on my Windows-7 64bit
    how i can connect and run any query on oracle ?
    what are the default tools that came with the installation and how to use it ?
    i sow in the forum that people write
    sql> select * from myTable ........
    how to get to this ?
    Open a command prompt and type
    sqlplus sys/syspwd@instance as sysdbaand you'll have yourself a sqlprompt.
    HTH
    //Johan

  • Finding the Text of SQL Query Causing Full Table Scan

    Hi,
    does anyone have a sql script, that shows the complete sql text of queries that have caused a full table scan?
    Please also let me know as to how soon this script needs to be run, in the sense does it work only while the query is running or would it work once it completes (if so is there a valid duration, such as until next restart, etc.)
    Your help is appreciated.
    Thx,
    Mayuran

    You might try something like this:
    select sql_text,
           object_name
    from   v$sql s,
           v$sql_plan p
    where  s.address = p.address and
           s.hash_value = p.hash_value and
           s.child_number = p.child_number and
           p.operation = 'TABLE ACCESS' and
           p.options = 'FULL' and
           p.object_owner in ('SCOTT')
    ;Please note that this query is just a snapshot of the SQL statements currently in the cache.

  • VARRAY bind parameter in IN clause causes Full Table Scan

    Hi
    My problem is that Oracle elects to perform a full table scan when I want it to use an index.
    The situation is this: I have a single table SQL query with an IN clause such as:
    SELECT EMPNO, ENAME, JOB FROM EMP WHERE ENAME IN (...)
    Since this is running in an application, I want to allow the user to provide a list of ENAMES to search. Because IN clauses don't accept bind parameters I've been using the Tom Kyte workaround which relies on setting a bind variable to an array-valued scalar, and then casting this array to be a table of records that the database can handle in an IN clause:
    SELECT *
    FROM EMP
    WHERE ENAME IN (
    SELECT *
    FROM TABLE(CAST( ? AS TABLE_OF_VARCHAR)))
    This resulted in very slow performance due to a full table scan. To test, I ran the SQL in SQL*Plus and provided the IN clause values in the query itself. The explain plan showed it using my index...ok good. But once I changed the IN clause to the 'select * from table...' syntax Oracle went into Full Scan mode. I added an index hint but it didn't change the plan. Has anyone had success using this technique without a full scan?
    Thanks
    John
    p.s.
    Please let me know if you think this should be posted on a different forum. Even though my context is a Java app developed with JDev this seemed like a SQL question.

    Justin and 3360 - that was great advice and certainly nothing I would have come up with. However, as posted, the performance still wasn't good...but it gave me a term to Google on. I found this Ask Tom page http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:3779680732446#15740265481549, where he included a seemingly magical 'where rownum >=0' which, when applied with your suggestions, turned my query from minutes into seconds.
    My plans are as follows:
    1 - Query with standard IN clause
    SQL> explain plan for
    2 select accession_number, protein_name, sequence_id from protein_dim
    3 where accession_number in ('33460', '33458', '33451');
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 7 | 336 | 4 |
    | 1 | INLIST ITERATOR | | | | |
    | 2 | TABLE ACCESS BY INDEX ROWID| PROTEIN_DIM | 7 | 336 | 4 |
    | 3 | INDEX RANGE SCAN | IDX_PROTEIN_ACCNUM | 7 | | 3 |
    Note: cpu costing is off, 'PLAN_TABLE' is old version
    11 rows selected.
    2 - Standard IN Clause with Index hint
    SQL> explain plan for
    2 select /*+ INDEX(protein_dim IDX_PROTEIN_ACCNUM) */
    3 accession_number, protein_name, sequence_id, taxon_id, organism_name, data_source
    4 from pdssuser.protein_dim
    5 where accession_number in
    6 ('33460', '33458', '33451');
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 7 | 588 | 4 |
    | 1 | INLIST ITERATOR | | | | |
    | 2 | TABLE ACCESS BY INDEX ROWID| PROTEIN_DIM | 7 | 588 | 4 |
    | 3 | INDEX RANGE SCAN | IDX_PROTEIN_ACCNUM | 7 | | 3 |
    Note: cpu costing is off, 'PLAN_TABLE' is old version
    11 rows selected.
    3 - Using custom TABLE_OF_VARCHAR type
    CREATE TYPE TABLE_OF_VARCHAR AS
    TABLE OF VARCHAR2(50);
    SQL> explain plan for
    2 select
    3 accession_number, protein_name, sequence_id, taxon_id, organism_name, data_source
    4 from pdssuser.protein_dim
    5 where accession_number in
    6 (select * from table(cast(TABLE_OF_VARCHAR('33460', '33458', '33451') as TABLE_OF_VARCHAR)) t);
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 2 | 168 | 57M|
    | 1 | NESTED LOOPS SEMI | | 2 | 168 | 57M|
    | 2 | TABLE ACCESS FULL | PROTEIN_DIM | 5235K| 419M| 13729 |
    | 3 | COLLECTION ITERATOR CONSTRUCTOR FETCH| | | | |
    Note: cpu costing is off, 'PLAN_TABLE' is old version
    11 rows selected.
    4 - Using custom TABLE_OF_VARCHAR type w/ Index hint
    SQL> explain plan for
    2 select /*+ INDEX(protein_dim IDX_PROTEIN_ACCNUM) */
    3 accession_number, protein_name, sequence_id, taxon_id, organism_name, data_source
    4 from pdssuser.protein_dim
    5 where accession_number in
    6 (select * from table(cast(TABLE_OF_VARCHAR('33460', '33458', '33451') as TABLE_OF_VARCHAR)) t);
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 2 | 168 | 57M|
    | 1 | NESTED LOOPS SEMI | | 2 | 168 | 57M|
    | 2 | TABLE ACCESS BY INDEX ROWID | PROTEIN_DIM | 5235K| 419M| 252K|
    | 3 | INDEX FULL SCAN | IDX_PROTEIN_ACCNUM | 5235K| | 17255 |
    | 4 | COLLECTION ITERATOR CONSTRUCTOR FETCH| | | | |
    PLAN_TABLE_OUTPUT
    Note: cpu costing is off, 'PLAN_TABLE' is old version
    12 rows selected.
    5 - Using custom TABLE_OF_VARCHAR type w/ cardinality hint
    SQL> explain plan for
    2 select
    3 accession_number, protein_name, sequence_id, taxon_id, organism_name, data_source from protein_dim
    4 where accession_number in (select /*+ cardinality( t 10 ) */
    5 * from TABLE(CAST (TABLE_OF_VARCHAR('33460', '33458', '33451') AS TABLE_OF_VARCHAR)) t);
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 2 | 168 | 57M|
    | 1 | NESTED LOOPS SEMI | | 2 | 168 | 57M|
    | 2 | TABLE ACCESS FULL | PROTEIN_DIM | 5235K| 419M| 13729 |
    | 3 | COLLECTION ITERATOR CONSTRUCTOR FETCH| | | | |
    Note: cpu costing is off, 'PLAN_TABLE' is old version
    11 rows selected.
    6 - Using custom TABLE_OF_VARCHAR type w/ cardinality hint
    and rownum >= 0 constraint
    SQL> explain plan for
    2 select
    3 accession_number, protein_name, sequence_id, taxon_id, organism_name, data_source from protein_dim
    4 where accession_number in (select /*+ cardinality( t 10 ) */
    5 * from TABLE(CAST (TABLE_OF_VARCHAR('33460', '33458', '33451') AS TABLE_OF_VARCHAR)) t
    6 where rownum >= 0);
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 25 | 2775 | 43 |
    | 1 | TABLE ACCESS BY INDEX ROWID | PROTEIN_DIM | 2 | 168 | 3 |
    | 2 | NESTED LOOPS | | 25 | 2775 | 43 |
    | 3 | VIEW | VW_NSO_1 | 10 | 270 | 11 |
    | 4 | SORT UNIQUE | | 10 | | |
    | 5 | COUNT | | | | |
    | 6 | FILTER | | | | |
    PLAN_TABLE_OUTPUT
    | 7 | COLLECTION ITERATOR CONSTRUCTOR FETCH| | | | |
    | 8 | INDEX RANGE SCAN | IDX_PROTEIN_ACCNUM | 2 | | 2 |
    Note: cpu costing is off, 'PLAN_TABLE' is old version
    16 rows selected.
    I don't understand why performance improved so dramatically but happy that it did.
    Thanks a ton!
    John

  • Entity Framework Generated SQL for paging or using Linq skip take causes full table scans.

    The slq genreated creates queries that cause a full table scan for pagination.  Is there any way to fix this?
    I am using
    ODP.NET ODTwithODAC1120320_32bit
    ASP.NET 4.5
    EF 5
    Oracle 11gR2
    This table has 2 million records. The further into the records you page the longer it takes.
    LINQ
    var cnt = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
                        select errorLog).Count();
                    var query = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
                                 orderby errorLog.ERR_LOG_ID
                                 select errorLog).Skip(cnt-10).Take(10).ToList();
    Here is the query & execution plans.
    SELECT *
    FROM   (SELECT "Extent1"."ERR_LOG_ID"  AS "ERR_LOG_ID",
                   "Extent1"."SRV_LOG_ID"  AS "SRV_LOG_ID",
                   "Extent1"."TS"          AS "TS",
                   "Extent1"."MSG"         AS "MSG",
                   "Extent1"."STACK_TRACE" AS "STACK_TRACE",
                   "Extent1"."MTD_NM"      AS "MTD_NM",
                   "Extent1"."PRM"         AS "PRM",
                   "Extent1"."INSN_ID"     AS "INSN_ID",
                   "Extent1"."TS_1"        AS "TS_1",
                   "Extent1"."LOG_ETRY"    AS "LOG_ETRY"
            FROM   (SELECT "Extent1"."ERR_LOG_ID"                                  AS "ERR_LOG_ID",
                           "Extent1"."SRV_LOG_ID"                                  AS "SRV_LOG_ID",
                           "Extent1"."TS"                                          AS "TS",
                           "Extent1"."MSG"                                         AS "MSG",
                           "Extent1"."STACK_TRACE"                                 AS "STACK_TRACE",
                           "Extent1"."MTD_NM"                                      AS "MTD_NM",
                           "Extent1"."PRM"                                         AS "PRM",
                           "Extent1"."INSN_ID"                                     AS "INSN_ID",
                           "Extent1"."TS_1"                                        AS "TS_1",
                           "Extent1"."LOG_ETRY"                                    AS "LOG_ETRY",
                           row_number() OVER (ORDER BY "Extent1"."ERR_LOG_ID" ASC) AS "row_number"
                    FROM   (SELECT "ERRORLOGANDSERVICELOG_VIEW"."ERR_LOG_ID"  AS "ERR_LOG_ID",
                                   "ERRORLOGANDSERVICELOG_VIEW"."SRV_LOG_ID"  AS "SRV_LOG_ID",
                                   "ERRORLOGANDSERVICELOG_VIEW"."TS"          AS "TS",
                                   "ERRORLOGANDSERVICELOG_VIEW"."MSG"         AS "MSG",
                                   "ERRORLOGANDSERVICELOG_VIEW"."STACK_TRACE" AS "STACK_TRACE",
                                   "ERRORLOGANDSERVICELOG_VIEW"."MTD_NM"      AS "MTD_NM",
                                   "ERRORLOGANDSERVICELOG_VIEW"."PRM"         AS "PRM",
                                   "ERRORLOGANDSERVICELOG_VIEW"."INSN_ID"     AS "INSN_ID",
                                   "ERRORLOGANDSERVICELOG_VIEW"."TS_1"        AS "TS_1",
                                   "ERRORLOGANDSERVICELOG_VIEW"."LOG_ETRY"    AS "LOG_ETRY"
                            FROM   "IDS_CORE"."ERRORLOGANDSERVICELOG_VIEW" "ERRORLOGANDSERVICELOG_VIEW") "Extent1") "Extent1"
            WHERE  ("Extent1"."row_number" > 1933849)
            ORDER  BY "Extent1"."ERR_LOG_ID" ASC)
    WHERE  (ROWNUM <= (10))
    | Id  | Operation              | Name                   | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT       |                        |    10 | 31750 |       |   821K  (1)| 02:44:15 |
    |*  1 |  COUNT STOPKEY         |                        |       |       |       |            |          |
    |   2 |   VIEW                 |                        |  1561K|  4728M|       |   821K  (1)| 02:44:15 |
    |*  3 |    VIEW                |                        |  1561K|  4748M|       |   821K  (1)| 02:44:15 |
    |   4 |     WINDOW SORT        |                        |  1561K|  3154M|  4066M|   821K  (1)| 02:44:15 |
    |*  5 |      HASH JOIN OUTER   |                        |  1561K|  3154M|       |   130K  (1)| 00:26:09 |
    |   6 |       TABLE ACCESS FULL| IDS_SERVICES_LOG       |  1047 | 52350 |       |     5   (0)| 00:00:01 |
    |   7 |       TABLE ACCESS FULL| IDS_SERVICES_ERROR_LOG |  1561K|  3080M|       |   130K  (1)| 00:26:08 |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM<=10)
       3 - filter("Extent1"."row_number">1933849)
       5 - access("T1"."SRV_LOG_ID"(+)="T2"."SRV_LOG_ID")

    I did try a sample from stack overflow that would apply it to all string types, but I didn't see any query results differences.  Please note, I am having the problem without any order with or where statements. Of course the skip take generates them.  Please advise how I would implement the EntityFunctions.AsNonUnicode method with this Linq query.
    LINQ
    var cnt = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
                        select errorLog).Count();
                    var query = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
                                 orderby errorLog.ERR_LOG_ID
                                 select errorLog).Skip(cnt-10).Take(10).ToList();
    This is what I inserted into my model to hopefully fix it.  FROM:c# - EF Code First - Globally set varchar mapping over nvarchar - Stack Overflow
    /// <summary>
    /// Change the "default" of all string properties for a given entity to varchar instead of nvarchar.
    /// </summary>
    /// <param name="modelBuilder"></param>
    /// <param name="entityType"></param>
    protected void SetAllStringPropertiesAsNonUnicode(
       DbModelBuilder modelBuilder,
       Type entityType)
       var stringProperties = entityType.GetProperties().Where(
      c => c.PropertyType == typeof(string)
       && c.PropertyType.IsPublic
       && c.

  • Locate SQL causes full table scans from Statspack

    Hello,
    In my statspack reports I see a lot of full tables scans (1,425,297)
    How can I locate the query that causes this ?
    stats$sql_plan should fit?
    Oracle is 9i
    Thank you

    >
    How can I locate the query that causes this ?
    It can be hard. One idea is to put comments in queries identifying where they come from, something like
    select /* my_package.my_procedure */ *
      from dual;
    [/code
    The comment should remain with the sql text so various reports showing the sql text should also indicate where the query is]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Tables in subquery resulting in full table scans

    Hi,
    This is related to a p1 bug 13009447. Customer recently upgraded to 10G. Customer reported this type of problem for the second time.
    Problem Description:
    All the tables in sub-query are resulting in full table scans and hence are executing for hours.
    Here is the query
    SELECT /*+ PARALLEL*/
    act.assignment_action_id
    , act.assignment_id
    , act.tax_unit_id
    , as1.person_id
    , as1.effective_start_date
    , as1.primary_flag
    FROM pay_payroll_actions pa1
    , pay_population_ranges pop
    , per_periods_of_service pos
    , per_all_assignments_f as1
    , pay_assignment_actions act
    , pay_payroll_actions pa2
    , pay_action_classifications pcl
    , per_all_assignments_f as2
    WHERE pa1.payroll_action_id = :b2
    AND pa2.payroll_id = pa1.payroll_id
    AND pa2.effective_date
    BETWEEN pa1.start_date
    AND pa1.effective_date
    AND act.payroll_action_id = pa2.payroll_action_id
    AND act.action_status IN ('C', 'S')
    AND pcl.classification_name = :b3
    AND pa2.consolidation_set_id = pa1.consolidation_set_id
    AND pa2.action_type = pcl.action_type
    AND nvl (pa2.future_process_mode, 'Y') = 'Y'
    AND as1.assignment_id = act.assignment_id
    AND pa1.effective_date
    BETWEEN as1.effective_start_date
    AND as1.effective_end_date
    AND as2.assignment_id = act.assignment_id
    AND pa2.effective_date
    BETWEEN as2.effective_start_date
    AND as2.effective_end_date
    AND as2.payroll_id = as1.payroll_id
    AND pos.period_of_service_id = as1.period_of_service_id
    AND pop.payroll_action_id = :b2
    AND pop.chunk_number = :b1
    AND pos.person_id = pop.person_id
    AND (
    as1.payroll_id = pa1.payroll_id
    OR pa1.payroll_id IS NULL
    AND NOT EXISTS
    SELECT /*+ PARALLEL*/ NULL
    FROM pay_assignment_actions ac2
    , pay_payroll_actions pa3
    , pay_action_interlocks int
    WHERE int.locked_action_id = act.assignment_action_id
    AND ac2.assignment_action_id = int.locking_action_id
    AND pa3.payroll_action_id = ac2.payroll_action_id
    AND pa3.action_type IN ('P', 'U')
    AND NOT EXISTS
    SELECT /*+ PARALLEL*/
    NULL
    FROM per_all_assignments_f as3
    , pay_assignment_actions ac3
    WHERE :b4 = 'N'
    AND ac3.payroll_action_id = pa2.payroll_action_id
    AND ac3.action_status NOT IN ('C', 'S')
    AND as3.assignment_id = ac3.assignment_id
    AND pa2.effective_date
    BETWEEN as3.effective_start_date
    AND as3.effective_end_date
    AND as3.person_id = as2.person_id
    ORDER BY as1.person_id
    , as1.primary_flag DESC
    , as1.effective_start_date
    , act.assignment_id
    FOR UPDATE OF as1.assignment_id
    , pos.period_of_service_id
    Here is the execution plan for this query. We tried adding hints in sub-query to force indexes to pick-up but it is still doing Full table scans.
    Suspecting some db parameter which is causing this issue.
    In the
    - Full table scans on tables in the first sub-query
    PAY_PAYROLL_ACTIONS, PAY_ASSIGNMENT_ACTIONS, PAY_ACTION_INTERLOCKS
    - Full table scans on tables in Second sub-query
    PER_ALL_ASSIGNMENTS_F PAY_ASSIGNMENT_ACTIONS
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 29 398.80 2192.99 238706 4991924 2383 0
    Fetch 1136 378.38 1921.39 0 4820511 0 1108
    total 1166 777.19 4114.38 238706 9812435 2383 1108
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 41 (APPS) (recursive depth: 1)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    0 FOR UPDATE
    0 PX COORDINATOR
    0 PX SEND (QC (ORDER)) OF ':TQ10009' [:Q1009]
    0 SORT (ORDER BY) [:Q1009]
    0 PX RECEIVE [:Q1009]
    0 PX SEND (RANGE) OF ':TQ10008' [:Q1008]
    0 HASH JOIN (ANTI BUFFERED) [:Q1008]
    0 PX RECEIVE [:Q1008]
    0 PX SEND (HASH) OF ':TQ10006' [:Q1006]
    0 BUFFER (SORT) [:Q1006]
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'PER_ALL_ASSIGNMENTS_F' (TABLE) [:Q1006]
    0 NESTED LOOPS [:Q1006]
    0 NESTED LOOPS [:Q1006]
    0 NESTED LOOPS [:Q1006]
    0 HASH JOIN (ANTI) [:Q1006]
    0 BUFFER (SORT) [:Q1006]
    0 PX RECEIVE [:Q1006]
    0 PX SEND (HASH) OF ':TQ10002'
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'PAY_ASSIGNMENT_ACTIONS' (TABLE)
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'PAY_PAYROLL_ACTIONS' (TABLE)
    0 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'PAY_PAYROLL_ACTIONS_PK' (INDEX (UNIQUE)
    0 INDEX MODE: ANALYZED (RANGE SCAN) OF 'PAY_POPULATION_RANGES_N4' (INDEX)
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'PER_PERIODS_OF_SERVICE' (TABLE)
    0 INDEX MODE: ANALYZED (RANGE SCAN) OF 'PER_PERIODS_OF_SERVICE_N3' (INDEX)
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'PER_ALL_ASSIGNMENTS_F' (TABLE)
    0 INDEX MODE: ANALYZED (RANGE SCAN) OF 'PER_ASSIGNMENTS_N4' (INDEX)
    0 INDEX MODE: ANALYZED (RANGE SCAN) OF 'PAY_ASSIGNMENT_ACTIONS_N51' (INDEX)
    0 PX RECEIVE [:Q1006]
    0 PX SEND (HASH) OF ':TQ10005' [:Q1005]
    0 VIEW OF 'VW_SQ_1' (VIEW) [:Q1005]
    0 HASH JOIN [:Q1005]
    0 BUFFER (SORT) [:Q1005]
    0 PX RECEIVE [:Q1005]
    0 PX SEND (BROADCAST) OF ':TQ10000'
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'PAY_PAYROLL_ACTIONS' (TABLE)
    0 HASH JOIN [:Q1005]
    0 PX RECEIVE [:Q1005]
    0 PX SEND (HASH) OF ':TQ10004' [:Q1004]
    0 PX BLOCK (ITERATOR) [:Q1004]
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'PAY_ASSIGNMENT_ACTIONS' (TABLE) [:Q1004]
    0 BUFFER (SORT) [:Q1005]
    0 PX RECEIVE [:Q1005]
    0 PX SEND (HASH) OF ':TQ10001'
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'PAY_ACTION_INTERLOCKS' (TABLE)
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'PAY_PAYROLL_ACTIONS' (TABLE) [:Q1006]
    0 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'PAY_PAYROLL_ACTIONS_PK' (INDEX (UNIQUE)) [:Q1006]
    0 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'PAY_ACTION_CLASSIFICATIONS_PK' (INDEX (UNIQUE))[:Q1006]
    0 INDEX MODE: ANALYZED (RANGE SCAN) OF 'PER_ASSIGNMENTS_F_PK' (INDEX (UNIQUE)) [:Q1006]
    0 PX RECEIVE [:Q1008]
    0 PX SEND (HASH) OF ':TQ10007' [:Q1007]
    0 VIEW OF 'VW_SQ_2' (VIEW) [:Q1007]
    0 FILTER [:Q1007]
    0 HASH JOIN [:Q1007]
    0 BUFFER (SORT) [:Q1007]
    0 PX RECEIVE [:Q1007]
    0 PX SEND (BROADCAST) OF ':TQ10003'
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'PER_ALL_ASSIGNMENTS_F' (TABLE)
    0 PX BLOCK (ITERATOR) [:Q1007]
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'PAY_ASSIGNMENT_ACTIONS' (TABLE) [:Q1007]
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    enq: KO - fast object checkpoint 32 0.02 0.12
    os thread startup 8 0.02 0.19
    PX Deq: Join ACK 198 0.00 0.04
    PX Deq Credit: send blkd 167116 1.95 1103.72
    PX Deq Credit: need buffer 327389 1.95 266.30
    PX Deq: Parse Reply 148 0.01 0.03
    PX Deq: Execute Reply 11531 1.95 1901.50
    PX qref latch 23060 0.00 0.60
    db file sequential read 108199 0.17 22.11
    db file scattered read 9272 0.19 51.74
    PX Deq: Table Q qref 78 0.00 0.03
    PX Deq: Signal ACK 1165 0.10 10.84
    enq: PS - contention 73 0.00 0.00
    reliable message 27 0.00 0.00
    latch free 218 0.00 0.01
    latch: session allocation 11 0.00 0.00
    Thanks in advance
    Suresh PV

    Hi,
    welcome,
    how is the query performing if you delete all the hints for PARALLEL, because most of the waits are related to waits on Parallel.
    Herald ten Dam
    http://htendam.wordpress.com
    PS. Use "{code}" for showing your code and explain plans, it looks nicer

  • Trunc causing Full Table Scans

    I have a situtaion here where my query is as follows.
    SQL> select count(1) from HBSM_SM_ACCOUNT_INFO where OPTIONAL_PARM5='MH' and CUST_STATUS in ('UP','UUP') and trunc(FIRST_ACTVN_DATE) = trunc(sysdate);
    COUNT(1)
    6
    PLAN_TABLE_OUTPUT
    Plan hash value: 3951750498
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 1 | 10 | 13904 (1)| 00:02:47 | | |
    | 1 | SORT AGGREGATE | | 1 | 10 | | | | |
    | 2 | PARTITION LIST SINGLE| | 1 | 10 | 13904 (1)| 00:02:47 | 12 | 12 |
    |* 3 | TABLE ACCESS FULL | HBSM_SM_ACCOUNT_INFO | 1 | 10 | 13904 (1)| 00:02:47 | 12 | 12 |
    Predicate Information (identified by operation id):
    3 - filter(("CUST_STATUS"='UP' OR "CUST_STATUS"='UUP') AND
    TO_DATE(INTERNAL_FUNCTION("FIRST_ACTVN_DATE"))=TO_DATE(TO_CHAR(SYSDATE@!)))
    16 rows selected.
    If I remove the trunc clause from the query the performance definitely improves the the results are wrong.
    SQL> select count(1) from HBSM_SM_ACCOUNT_INFO where OPTIONAL_PARM5='MH' and CUST_STATUS in ('UP','UUP') and FIRST_ACTVN_DATE = trunc(sysdate);
    COUNT(1)
    0
    PLAN_TABLE_OUTPUT
    Plan hash value: 454529511
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 1 | 40 | 47 (0)| 00:00:01 | | |
    |* 1 | TABLE ACCESS BY GLOBAL INDEX ROWID| HBSM_SM_ACCOUNT_INFO | 1 | 40 | 47 (0)| 00:00:01 | 12 | 12 |
    |* 2 | INDEX RANGE SCAN | IND_FIRST_ACTVN_DATE | 51 | | 4 (0)| 00:00:01 | | |
    Can someone please help me whereby I can get the right data and I can also prevent these full table scans.

    Unless you are using a functional index, applying any function to an indexed column prevents the use of the index.
    The way round it in your case is to realise that
    select count(1) from HBSM_SM_ACCOUNT_INFO where OPTIONAL_PARM5='MH' and CUST_STATUS in ('UP','UUP') and trunc(FIRST_ACTVN_DATE) = trunc(sysdate)Is really asking that FIRST_ACTVN_DATE should be sometime today. You could therefore rewrite it as
    select count(1) from HBSM_SM_ACCOUNT_INFO where OPTIONAL_PARM5='MH' and CUST_STATUS in ('UP','UUP')
    and FIRST_ACTVN_DATE >= trunc(sysdate)
    and FIRST_ACTVN_DATE < trunc(sysdate) + 1Note, this still might not use the index depending on how many rows are within today's date versus how many are outside today's date.
    Also, when posting, remember to put your code between tags and to post create table scripts and sample data inserts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Where columnname like '%somevalue' causing full table scan

    hi,
    10.2.0.4 database
    is it possible to force an index scan over a full table scan if I use a where clause similar to the following:
    where col1 like '%somevalue';
    There is an index with col1 as the first segment of the index and another column as the second segment of the index.
    Thanks
    JOhn

    I have done it for you
    SQL> create index empX on emp(job) ;
    Index created.
    SQL> explain plan for select * from emp where job like '%ERK' ;
    Explained.
    SQL> select * from table(dbms_xplan.display) ;
    PLAN_TABLE_OUTPUT
    Plan hash value: 3956160932
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |    37 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |     1 |    37 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("JOB" LIKE '%ERK')
    13 rows selected.
    SQL> explain plan for select * from emp where job like 'C%ERK' ;
    Explained.
    SQL> select * from table(dbms_xplan.display) ;
    PLAN_TABLE_OUTPUT
    Plan hash value: 140376749
    | Id  | Operation                   | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |      |     4 |   148 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| EMP  |     4 |   148 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | EMPX |     4 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("JOB" LIKE 'C%ERK')
           filter("JOB" LIKE 'C%ERK')
    15 rows selected.
    SQL> explain plan for select /*+index (emp,EMPX) */ * from emp where job like '%ERK' ;
    Explained.
    SQL> select * from table(dbms_xplan.display) ;
    PLAN_TABLE_OUTPUT
    Plan hash value: 3745534319
    | Id  | Operation                   | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |      |     1 |    37 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| EMP  |     1 |    37 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX FULL SCAN           | EMPX |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter("JOB" LIKE '%ERK')
    14 rows selected.SS

  • SQL Performance causing full table scan

    I have this SQL:
    SELECT DISTINCT
    UPPER (RTRIM (LTRIM (SS.PRESCDEAID))) PRESCRIBER,
    UPPER (RTRIM (LTRIM (SS.NPIPRESCR))) NPI_NUMBER
    FROM
    PBM_SXC_STAGING SS,
    PBM_PHYSICIANS P
    WHERE
    P.PHYSICIAN_ID = SS.PRESCDEAID
    AND P.NPI_NUMBER <> SS.NPIPRESCR
    AND SS.NPIPRESCR <> SS.PRESCDEAID
    Uses this plan:
    SELECT STATEMENT ALL_ROWSCost: 13,843 Bytes: 3,636,232 Cardinality: 106,948                
         4 SORT UNIQUE Cost: 13,843 Bytes: 3,636,232 Cardinality: 106,948           
              3 HASH JOIN Cost: 12,866 Bytes: 3,636,232 Cardinality: 106,948      
                   1 TABLE ACCESS FULL TABLE PBM.PBM_PHYSICIANS Cost: 4,156 Bytes: 17,639,063 Cardinality: 1,356,851
                   2 INDEX FAST FULL SCAN INDEX PBM.SXCSTG_IDX1 Cost: 3,859 Bytes: 43,302,882 Cardinality: 2,062,042
    If I comment out "AND P.NPI_NUMBER <> SS.NPIPRESCR" I get this plan that uses the PK index (PBM.PBM_PHYSICIAN_PK) that is on P.PHYSICIAN_ID. I do have an index on P.NPI_NUMBER
    SELECT STATEMENT ALL_ROWSCost: 27,230 Bytes: 64,514,496 Cardinality: 2,016,078                
         4 SORT UNIQUE Cost: 27,230 Bytes: 64,514,496 Cardinality: 2,016,078           
              3 HASH JOIN Cost: 9,617 Bytes: 64,514,496 Cardinality: 2,016,078      
                   1 INDEX FAST FULL SCAN INDEX (UNIQUE) PBM.PBM_PHYSICIAN_PK Cost: 1,035 Bytes: 14,925,361 Cardinality: 1,356,851
                   2 INDEX FAST FULL SCAN INDEX PBM.SXCSTG_IDX1 Cost: 3,859 Bytes: 43,302,882 Cardinality: 2,062,042

    Sorry for the delay, I was out of the office.
    PLAN_TABLE_OUTPUT
    SQL_ID  4j270u8fbhwpu, child number 0
    SELECT /*+ gather_plan_statistics */          DISTINCT          upper
    (rtrim (ltrim (ss.prescdeaid))) prescriber         ,upper (rtrim (ltrim
    (ss.npiprescr))) npi_number FROM pbm_sxc_staging ss     ,pbm_physicians
    p WHERE p.physician_id = ss.prescdeaid   AND p.npi_number !=
    ss.npiprescr   AND ss.npiprescr != ss.prescdeaid
    Plan hash value: 2275909877
    PLAN_TABLE_OUTPUT
    | Id  | Operation              | Name           | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |   1 |  HASH UNIQUE           |                |      1 |    125K|     68 |00:00:01.54 |   24466 |  14552 |  1001K|  1001K| 1296K (0)|
    |*  2 |   HASH JOIN            |                |      1 |    125K|   6941 |00:00:01.14 |   24466 |  14552 |    47M|  6159K|   68M (0)|
    |   3 |    TABLE ACCESS FULL   | PBM_PHYSICIANS |      1 |   1341K|   1341K|00:00:00.01 |   14556 |  14552 |       |       |          |
    |*  4 |    INDEX FAST FULL SCAN| SXCSTG_IDX1    |      1 |   1872K|   1887K|00:00:00.01 |    9910 |   0 |          |       |          |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       2 - access("P"."PHYSICIAN_ID"="SS"."PRESCDEAID")
           filter("P"."NPI_NUMBER"<>"SS"."NPIPRESCR")
       4 - filter("SS"."NPIPRESCR"<>"SS"."PRESCDEAID")Edited by: Chris on Jul 12, 2011 8:19 AM

  • 10G bug: Simple query terminate oracle session in 10g

    The following query fails because it terminates the connection to the oracle database. This only occurs in 10g and Oracle XE. Below that query is the structure of the table and sql statements to populate the table.
    I got this from a friend who tried to use 10g, but had to upgrade to Oracle 9 :-) I tested it with Oracle XE. Same problem with 10g and XE. We both use fully patched Windows XP professional.
    greetings
    SELECT ID_LEVSVIKTPOT
    FROM T_RISA_LEVSVIKTPOT
    WHERE KRITISK_FORBRUKER = -1;
    ---- 8< data definition 8< ----
    CREATE TABLE T_RISA_LEVSVIKTPOT
    ID_LEVSVIKTPOT INTEGER DEFAULT 0 NOT NULL,
    NAVN VARCHAR2(50 BYTE),
    LT INTEGER DEFAULT 0,
    GT INTEGER DEFAULT 0,
    KRITISK_FORBRUKER INTEGER DEFAULT -1 NOT NULL
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    NOMONITORING;
    ALTER TABLE T_RISA_LEVSVIKTPOT ADD (
    CHECK (Kritisk_Forbruker = 0 or Kritisk_Forbruker = -1),
    PRIMARY KEY
    (ID_LEVSVIKTPOT));
    INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
    KRITISK_FORBRUKER ) VALUES (
    1, '< 10 MW', 10, 0, 0);
    INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
    KRITISK_FORBRUKER ) VALUES (
    2, '10 - 1000 MV', 1000, 10, 0);
    INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
    KRITISK_FORBRUKER ) VALUES (
    3, '> 1000 MV og/eller kritisk forbruker', -1, 1000, -1);
    commit;

    Could not reproduce on my 10gR2 system. What error are you getting and is a trace file produced?
    test@ORCL> CREATE TABLE T_RISA_LEVSVIKTPOT
      2  (
      3  ID_LEVSVIKTPOT INTEGER DEFAULT 0 NOT NULL,
      4  NAVN VARCHAR2(50 BYTE),
      5  LT INTEGER DEFAULT 0,
      6  GT INTEGER DEFAULT 0,
      7  KRITISK_FORBRUKER INTEGER DEFAULT -1 NOT NULL
      8  )
      9  TABLESPACE USERS
    10  PCTUSED 0
    11  PCTFREE 10
    12  INITRANS 1
    13  MAXTRANS 255
    14  STORAGE (
    15  INITIAL 64K
    16  MINEXTENTS 1
    17  MAXEXTENTS 2147483645
    18  PCTINCREASE 0
    19  BUFFER_POOL DEFAULT
    20  )
    21  LOGGING
    22  NOCOMPRESS
    23  NOCACHE
    24  NOPARALLEL
    25  NOMONITORING;
    Table created.
    Elapsed: 00:00:00.35
    test@ORCL>
    test@ORCL> ALTER TABLE T_RISA_LEVSVIKTPOT ADD (
      2  CHECK (Kritisk_Forbruker = 0 or Kritisk_Forbruker = -1),
      3  PRIMARY KEY
      4  (ID_LEVSVIKTPOT));
    Table altered.
    Elapsed: 00:00:00.21
    test@ORCL> INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
      2  KRITISK_FORBRUKER ) VALUES (
      3  1, '< 10 MW', 10, 0, 0);
    1 row created.
    Elapsed: 00:00:00.01
    test@ORCL> INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
      2  KRITISK_FORBRUKER ) VALUES (
      3  2, '10 - 1000 MV', 1000, 10, 0);
    1 row created.
    Elapsed: 00:00:00.01
    test@ORCL> INSERT INTO T_RISA_LEVSVIKTPOT ( ID_LEVSVIKTPOT, NAVN, LT, GT,
      2  KRITISK_FORBRUKER ) VALUES (
      3  3, '> 1000 MV og/eller kritisk forbruker', -1, 1000, -1);
    1 row created.
    Elapsed: 00:00:00.00
    test@ORCL> commit;
    Commit complete.
    Elapsed: 00:00:00.00
    test@ORCL> SELECT ID_LEVSVIKTPOT
      2  FROM T_RISA_LEVSVIKTPOT
      3  WHERE KRITISK_FORBRUKER = -1;
    ID_LEVSVIKTPOT
                 3
    Elapsed: 00:00:00.00
    test@ORCL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    Elapsed: 00:00:00.03
    test@ORCL>

  • Errors in simple query in oracle 9i personal edition

    hi,
    i have oracle 9i personal edition release 9.0.1.1.1 - production.
    with it came sql*plus release 9.0.1.0.1 - production
    i have installed it on windows 98SE
    what i did is the following
    step 1:
    create type address_ty as object
    (street varchar2(50),
    city varchar2(50),
    state char(2),
    zip number);
    when i executed i got message "type created"
    step 2 :
    create table customer
    (cust_id number ,
    person address_ty);
    when i executed this i got message "table created"
    step 3 :
    insert into customer values
    (3,address_ty('xyz','abc','AP',4563));
    i get messsage "1 row created"
    step 4 :
    select cust_id,person.street from customer;
    i get error message .......
    select cust_id,person.street from customer;
    ERROR at line 1:
    ORA-00904: invalid column name
    i tried this example from the book "Oracle Complete Reference" from oracle press.
    what is the problem how to avoid it.
    i am a beginner help
    gopal

    hi! i'm not very sure, but your second field selected is person.street, do you have this field?
    why not try just select * from tablename, you should see the result.
    hope that helps.
    rgds.

  • Problems with query via Database-Link (Oracle 7.3.4)

    I made the following simple query via database-link.
    select count (*) from [email protected]
    I got the result in about 200 miliseconds.
    Then I4ve tried the following query.
    select * from [email protected]
    It took about 2 hours end ended with an error message "ORA-03113: end-of-file on communication channel"
    So I made another choice
    select * from [email protected] where rownum <=1
    Took about 200 miliseconds.
    So I made the query again an changed only the number of rownums,until I was at rownum <=8
    then it went sleeping again(I've canceled the statement because I didn't want to wait 2 hours again).
    We made the same things from another server with the same database-link on the same remote server
    and we had no problems.
    Any Idea???

    No, network is OK!
    Other links are running, I have also no problems when I connect directly to the remote server.

  • Star Query Full Table Scan

    Hi, Folks:
    I have a complex SQL statement that runs very slowly.
    Following is the statement:
    SELECT
    T3.POSITION_ID,
    T12.PR_POSTN_ID,
    T12.PR_TERR_ID,
    T12.PR_REP_MANL_FLG,
    T9.CREATED,
    T10.PR_EMP_ID,
    T9.MODIFICATION_NUM,
    T12.DEDUP_TOKEN,
    T12.LOCATION_LEVEL,
    T12.PR_PRTNR_OU_ID,
    T12.PR_OU_TYPE_ID,
    T12.PAR_DUNS_NUM,
    T3.ACCNT_NAME,
    T11.ATTRIB_16,
    T6.PAR_ROW_ID,
    T3.INVSTR_FLG,
    T6.ROW_ID,
    T12.DUNS_NUM,
    T12.BU_ID,
    T10.ROW_ID,
    T2.LAST_NAME,
    T3.SRV_PROVDR_FLG,
    T12.X_PR_MERCH_NBR_ID,
    T3.ROW_STATUS,
    T12.NAME,
    T11.PAR_ROW_ID,
    T6.LAST_UPD_BY,
    T6.MODIFICATION_NUM,
    T3.PRIORITY_FLG,
    T10.NAME,
    T3.ASGN_SYS_FLG,
    T9.PROFIT,
    T12.PR_BL_ADDR_ID,
    T12.PR_REP_ASGN_TYPE,
    T9.LAST_UPD_BY,
    T3.FACILITY_FLG,
    T12.LAST_UPD_BY,
    T12.PR_SHIP_ADDR_ID,
    T11.MODIFICATION_NUM,
    T11.LAST_UPD_BY,
    T5.LOGIN,
    T3.ASGN_MANL_FLG
    FROM
    S_ADDR_ORG T1,
    S_CONTACT T2,
    S_ACCNT_POSTN T3,
    S_ORG_INT T4,
    S_EMPLOYEE T5,
    S_ORG_EXT_FNX T6,
    S_ORG_SYN T7,
    S_INDUST T8,
    S_ORG_EXT_T T9,
    S_POSTN T10,
    S_ORG_EXT_X T11,
    S_ORG_EXT T12
    WHERE
    T12.BU_ID = T4.ROW_ID (+) AND
    T12.PR_CON_ID = T2.ROW_ID (+) AND
    T12.ROW_ID = T7.OU_ID AND
    T12.ROW_ID = T11.PAR_ROW_ID (+) AND
    T12.ROW_ID = T6.PAR_ROW_ID (+) AND
    T12.ROW_ID = T9.PAR_ROW_ID (+) AND
    T12.PR_INDUST_ID = T8.ROW_ID (+) AND
    T12.PR_ADDR_ID = T1.ROW_ID (+) AND
    T12.PR_POSTN_ID = T10.ROW_ID AND
    T12.PR_POSTN_ID = T3.POSITION_ID AND
    T12.ROW_ID = T3.OU_EXT_ID AND
    T10.PR_EMP_ID = T5.ROW_ID (+) AND
    (T12.X_BMO_CUST_FLG = 'Y') AND
    (T7.NAME IS NULL );
    ***** SQL Statement Execute Time: 31.703 seconds *****
    I do a explain plan and found the table S_ORG_EXT (T12)
    get a full table scan.
    But I found the table S_ORG_EXT did have lots of indexes
    build on each column shown in the where statement.
    Our database use RULE base optimizer and it should use
    index instead of full table scan.
    Then, I look at this SQL and realize it is a star query.
    One more thing is that the table S_ORG_SYN (T7) defined
    the column NAME as NOT NULL. If the query process, it
    should return no row.
    But I still don't know for what reason the Oracle use
    full table scan and ignore the S_ORG_SYN.NAME should be
    NOT NULL
    If I want to avoid the full table scan, how can I do by
    not switching to COST base optimizer mode ?
    Thanks,
    Ke

    Michael:
    A nice explanantion. In my experience, in versions up to 8.1.7, the RBO seems to be faster in the large majority of queries than the CBO. In our payroll application (version 8.0.5), removing statistics cut the time for the calculation run from 6.5 hours to under 2.
    The CBO seems to be significantly faster in 9i. We only have one application currently running in a 9.0.1 database. In this app, a large stored procedure took about 2 minutes to run when there were no statistics, and about 10 seconds after we analyzed the tables.
    As more of our vendors migrate to 9 (we just got the last vendor migrated off 7.3 to 8.0.6 a couple of months ago), I may become a bigger fan of the CBO. John,
    I remember having a discussion with you about the CBO in a thread once and am aware of your opinion of the CBO. My opinion has been test which works for you RBO or CBO - in our case we verified that CBO worked better for us. Anyway, I was searching metalink and it looks like you'll be forced to become a "bigger fan" of the CBO after 9i release 2. This is from part of Doc ID 189702.1 on metalink:
    The rule-based optimizer (RBO) will be no longer be a valid optimization choice when Oracle9i is de-supported. The release after Oracle9i
    (referred to in this article as Oracle10i) will only support the cost-based optimizer (CBO). Hence Oracle9i Release 2 is the last releases to
    contain the RBO. Partners and customers should certify their applications with the CBO before that time.
    ...but of course Oracle has been warning people of the demise of the RBO for some time.
    Al

Maybe you are looking for

  • Unable to initialize hdv deck problem

    Hi all, I'm having the 'unable to initialize hdv deck' problem. I am trying to capture HD footage from a Sony HVR-A1E camera. iLink and down conversion are off (like they should be) and I have just captured a HD tape before the problem started. I don

  • How do I install Windows XP Pro OEM?

    I have installed a legitimate copy of Windows XP Pro OEM I purchased from Ebay. (when i bought it i didnt know there was a difference i thought one was just mass produced and the other was retail pretty produced.) So now windows xp is popping up with

  • The dreaded 404 message using basicHttpBinding, Transport security mode, and certificates

    I am working on setting up a WCF service using mutual authentication with both client and server certifiates. The service is hosted in IIS 7, and I'm trying to access it from a simple console app. When I try to connect to the service, I get the error

  • Illustrator, Really? Fast Image Crop

    Hi guys, I decided to start this post with "Really?" like a SNL sketch...hehe. I have been using Illustrator for quite a while but i am not expert with it. One feature that really bothers me is that i can't really fast crop an image unless i draw a r

  • Corrected FSB, now K7N2 won't POST - Need help!!

    AMD XP 2600+ TBred B Core 1024 (2x512) MB PC3200 DDR SDRAM (Corsair XMS Series) 1 is C2 latency, 1 is normal PC3200.  I had them both in channel A, right now I'm just running my brand new normal 3200 stick. MSI GeForce6600GT (NX6600GT-VTD128SP) MSI K