does not use the INDEX

I have problem with a query as follows. It does not index when I keep a function on the left side of the comparison in which the condition.

But when I remove the function is using the index.

With BLC AS 
Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                        NOT NULL NUMBER
 MASTER_VALUE               NOT NULL NUMBER(8)
 DESC_TEXT_ID                                    NUMBER
 GVM                                                     VARCHAR2(50)
 MASTER_LOOKUP_ID    NOT NULL  NUMBER
 WORK_SECTION_ID                          NUMBER
 AUDIT_TRAIL_NO                              NUMBER
 

SQL> SELECT COUNT(*) FROM BLC;
  COUNT(*)
----------
      7769

SQL> SELECT COUNT(DISTINCT(GVM)) "distinct" FROM BLC;
  distinct
----------
      1350

SQL> SELECT COUNT(*) "nulls" FROM BLC WHERE GVM IS NULL;

     nulls
----------
      6419

SQL> SELECT COLUMN_NAME,INDEX_NAME FROM DBA_IND_COLUMNS WHERE TABLE_NAME='BLC';

COLUMN_NAME                              INDEX_NAME
---------------------------------------- ------------------------------
MASTER_LOOKUP_ID      LKPCDE_MSTLKP_FK_I
WORK_SECTION_ID        LKPCDE_WRKSEC_FK_I
GVM                                   LKPCDE_UK
MASTER_VALUE              LKPCDE_MASTERID_VALUE_UK
MASTER_LOOKUP_ID     LKPCDE_MASTERID_VALUE_UK
ID                                       LKPCDE_PK

SQL> EXPLAIN PLAN FOR SELECT ID FROM BLC WHERE UPPER ( GVM) = 'MAIN_ORG';
Explained.
SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3196655606
--------------------------------------------------------------------------------------
| Id  | Operation         | Name             | Rows  | Bytes | Cost (%CPU)| Time|
--------------------------------------------------------------------------------------

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |                  |    78 |   624 |    18   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| BLC |    78 |   624 |    18   (0)| 00:00:01 |
--------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------
   1 - filter(UPPER("GVM")='MAIN_ORG')
13 rows selected.


SQL> EXPLAIN PLAN FOR SELECT ID FROM BLC WHERE GVM
  = 'MAIN_ORG';
Explained.
SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 1620245961
--------------------------------------------------------------------------------
----------------
| Id  | Operation                   | Name             | Rows  | Bytes | Cost (%
CPU)| Time     |
--------------------------------------------------------------------------------
----------------

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |                  |     1 |     8 |     2
 (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| BLC |     1 |     8 |     2
 (0)| 00:00:01 |
|*  2 |   INDEX UNIQUE SCAN         | LKPCDE_UK        |     1 |       |     1
 (0)| 00:00:01 |
--------------------------------------------------------------------------------
----------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   2 - access("GVM"='MAIN_ORG')
14 rows selected.

SQL> EXPLAIN PLAN FOR SELECT /* INDEX(LKPCDE_UK) */ ID FROM BLC WHE
RE UPPER ( GVM ) = 'MAIN_ORG';
Explained.
SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3196655606
--------------------------------------------------------------------------------
------
| Id  | Operation         | Name             | Rows  | Bytes | Cost (%CPU)| Time
     |
--------------------------------------------------------------------------------
------

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |                  |    78 |   624 |    18   (0)| 00:0
0:01 |
|*  1 |  TABLE ACCESS FULL| BLC |    78 |   624 |    18   (0)| 00:0
0:01 |
--------------------------------------------------------------------------------
------

Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
---------------------------------------------------
   1 - filter(UPPER("GVM")='MAIN_ORG')
13 rows selected.

Please let me know how I can force it to use an index as it is causing the CPU usage.

I can't change the query in the application it is used in several places.

Thank you

And/or read: ORACLE-BASE - Oracle function index

Tags: Database

Similar Questions

  • Setting the query: optimizer does not use the index function

    Hello

    I have a request written by a developer that I can't change.

    It is here that the condition:

    (   UPPER(TRIM (CODFSC)) = UPPER (TRIM ( '01923980500'))

           OR UPPER(TRIM (CODUIC)) = UPPER (TRIM ( '01923980500')))

    There is an index on CODFSC and on CODUIC1.

    the plan is:

    Plan

    INSTRUCTION SELECT ALL_ROWS cost: 9 194 bytes: 3 206 502 cardinality: 15 054

    ACCESS FULL ANAGRAFICA cost TABLE TABLE 1: 9 194 bytes: 3 206 502 cardinality: 15 054

    So I created two new index on SUPERIOR (TRIM ()CODFSC)) and SUPERIOR (TRIM ()CODUIC)) but the plan

    complete analysis of STIL.

    Modifing where condition in:

    (   CODFSC = UPPER (TRIM ( '01923980500'))

           OR CODUIC = UPPER (TRIM ( '01923980500')))

    the plan is:

    SELECT STATEMENT ALL_ROWSCost: 157 bytes: 426 cardinality: 2

    CONCATENATION OF 5

    TABLE ACCESS BY INDEX ROWID ANAGRAFICA cost TABLE 2: cardinality of 5 bytes: 213: 1

    1 INDEX RANGE SCAN INDEX ANAGRAFICA_IDX01 cost: cardinality 3: 1

    TABLE ACCESS BY INDEX ROWID ANAGRAFICA cost TABLE 4: cardinality 152 bytes: 213: 1

    3 INDEX SKIP SCAN INDEX ANAGRAFICA_IDX02 cost: cardinality 1: 151

    Why optimizer not use my funct index?

    Thank you.

    Franck,

    I always forget that the default value for the GOLD expansion depends on a path indexed for each branch.

    2 in your use of or_predicates (2) depends on the position of complex predicate which must be expanded.  If you change the order of predicate 'State = 0' to display AFTER the complex predicate, you must change the indicator of "or_predicates (1).

    Outside of the current state of undocumented indicator, it also introduces the disturbing thought that, for a more complex query, a change in the transformation may result in another set of query blocks generated with a different ranking of the predicates. Yet another case to ensure that if you suggest anything suggest you (or create a SQL database).

    Concerning

    Jonathan Lewis

  • Query is not using the index. (Included execution plan. TKPROF output not available)

    Hi all

    Version of DB: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

    Here is the description of the problem:
    (The statistics are up to date for all tables).

    The query below does not use the index on ACCOUNTS_LIVE (ID). (Unique index)
    SQL> explain plan for
      2  select txn.account_number,to_number(txn.amount_lcy) txn_amt,to_date(booking_date,'YYYYMMDD') TXN_DATE,
      3        sal.latest_sal,sal.sal_date,customer_name,employer_name,
      4       decode(COMMUNICATION_TYPE_1,'MOBILE',COMMUNICATION_NO_1,
      5            decode(COMMUNICATION_TYPE_2,'MOBILE',COMMUNICATION_NO_2)) mob,
      6       txn.CURRENCY, CHEQUE_NUMBER,trans_dets,trans_reference,target,teller_id,acc.category,acc.inactive_marker,
      7            acc.posting_restrict,cus.sector,cus.industry
      8  from coreadmin.Gtxn_dtl_v1 txn,
      9                     (select account_number,round(to_number(nvl(amount_lcy,0)),2) latest_sal,TXN_DATE sal_date,rr
     10                      from
     11                        (select to_date(booking_date,'YYYYMMDD') TXN_DATE,batch_id,account_number,amount_lcy
     12                             ,row_number() over (partition by account_number
     13                                                     order by to_date(booking_date,'YYYYMMDD') desc NULLS LAST,
     14                                                     batch_id desc nulls last) rr,
     15                                     CURRENCY, CHEQUE_NUMBER,trans_dets,trans_reference
     16                             from coreadmin.Gtxn_dtl_v1
     17                             where transaction_code in ('204','938')
     18                  and to_number(amount_lcy) > 0)
     19                             where rr = 1
     20                       ) sal,accounts_live acc,customers_live cus
     21  where to_date(booking_date,'YYYYMMDD') between to_date('030109','DDMMRR') and to_date('020209','DDMMRR')
     22  and txn.account_number = sal.account_number
     23  and txn.account_number = acc.id
     24  and txn.CUSTOMER_ID = cus.CUSTOMER_number
     25  and target in ('30','31','32')
     26  /
    
    Explained.
    
    SQL> select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT                                                                                                                                     
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 920245766                                                                                                                            
                                                                                                                                                          
    -----------------------------------------------------------------------------------------------------------                                           
    | Id  | Operation                        | Name           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                           
    -----------------------------------------------------------------------------------------------------------                                           
    |   0 | SELECT STATEMENT                 |                |   363M|   121G|       |   223K  (4)| 00:44:47 |                                           
    |*  1 |  HASH JOIN                       |                |   363M|   121G|  6232K|   223K  (4)| 00:44:47 |                                           
    |*  2 |   VIEW                           |                | 34453 |  5820K|       |   147K  (1)| 00:29:36 |                                           
    |*  3 |    WINDOW SORT PUSHED RANK       |                | 34453 |  1480K|  4072K|   147K  (1)| 00:29:36 |                                           
    |*  4 |     FILTER                       |                |       |       |       |            |          |                                           
    |   5 |      INLIST ITERATOR             |                |       |       |       |            |          |                                           
    |*  6 |       TABLE ACCESS BY INDEX ROWID| GTXN_DTL_V1    | 34453 |  1480K|       |   147K  (1)| 00:29:31 |                                           
    |*  7 |        INDEX RANGE SCAN          | IDX_TXN5       |   707K|       |       |  1815   (2)| 00:00:22 |                                           
    |*  8 |   HASH JOIN                      |                |   598K|   106M|    20M| 63724   (1)| 00:12:45 |                                           
    |*  9 |    MAT_VIEW ACCESS FULL          | CUSTOMERS_LIVE |   227K|    17M|       |  2239   (4)| 00:00:27 |                                           
    |* 10 |    HASH JOIN                     |                |   598K|    59M|  9504K| 57157   (1)| 00:11:26 |                                           
    |  11 |     MAT_VIEW ACCESS FULL         | ACCOUNTS_LIVE  |   249K|  6577K|       |  1832   (2)| 00:00:22 |                                           
    |* 12 |     TABLE ACCESS BY INDEX ROWID  | GTXN_DTL_V1    |   597K|    43M|       | 52319   (1)| 00:10:28 |                                           
    |* 13 |      INDEX RANGE SCAN            | IDX_TXN11_V1   |  1204K|       |       |  3931   (2)| 00:00:48 |                                           
    -----------------------------------------------------------------------------------------------------------                                           
                                                                                                                                                          
    Predicate Information (identified by operation id):                                                                                                   
    ---------------------------------------------------                                                                                                   
                                                                                                                                                          
       1 - access("TXN"."ACCOUNT_NUMBER"="ACCOUNT_NUMBER")                                                                                                
       2 - filter("RR"=1)                                                                                                                                 
       3 - filter(ROW_NUMBER() OVER ( PARTITION BY "ACCOUNT_NUMBER" ORDER BY                                                                              
                  TO_DATE("BOOKING_DATE",'YYYYMMDD') DESC  NULLS LAST,INTERNAL_FUNCTION("BATCH_ID") DESC  NULLS                                           
                  LAST)<=1)                                                                                                                               
       4 - filter(TO_DATE('030109','DDMMRR')<=TO_DATE('020209','DDMMRR'))                                                                                 
       6 - filter(TO_NUMBER("AMOUNT_LCY")>0)                                                                                                              
       7 - access("TRANSACTION_CODE"='204' OR "TRANSACTION_CODE"='938')                                                                                   
       8 - access("TXN"."CUSTOMER_ID"="CUS"."CUSTOMER_NUMBER")                                                                                            
       9 - filter("TARGET"='30' OR "TARGET"='31' OR "TARGET"='32')                                                                                        
      10 - access("TXN"."ACCOUNT_NUMBER"="ACC"."ID")                                                                                                      
      12 - filter("TXN"."CUSTOMER_ID" IS NOT NULL)                                                                                                        
      13 - access(TO_DATE("BOOKING_DATE",'YYYYMMDD')>=TO_DATE('030109','DDMMRR') AND                                                                      
                  TO_DATE("BOOKING_DATE",'YYYYMMDD')<=TO_DATE('020209','DDMMRR'))                                                                         
    
    38 rows selected.
    
    SQL> select index_name
      2  from dba_ind_columns
      3  where table_name = 'ACCOUNTS_LIVE'
      4  and column_name = 'ID';
    
    INDEX_NAME                                                                                                                                            
    ------------------------------                                                                                                                        
    IDX_ACCLIVE                                                                                                                                           
    Line 23 of the query uses accounts_live.id.

    11 the order ID explain plan shows that the index does not use.

    Please suggest.

    Thanks in advance,
    Jac

    What happens when you force the index by using hint and use the hash between txn and acc join?

    See you soon
    Sarma.

  • Why an amplification of the RAM does not change the index performnance of windows vista?

    Why an amplification of the RAM does not change the index performnance of windows Vista?

    Hello

    I m not very well, but maybe you have more than 3 GB of RAM and Vista 32 bit.
    Usually the 32 bit OS is capable to manage and send only 3.2 GB.
    The more than 3.2 GB RAM will not operating system used and therefore would not increase the index
    In addition the laptop will be not really faster after upgrading RAM. You will notice better performance using applications at the same time, but this does not affect the index of Vista.
    But this is only my personal hypothesis.

    Welcome them

  • part of the screen lack sound as if all type of himself downplayed a little and does not use the entire screen

    I have a dell studio with vista, I shot it today and the far right 1/4 of my screen has disappeared, its like everything kind of himself downplayed a little and does not use the entire screen. I didn't change anything or add programs. someone has an idea?

    Hi musicwatkins


    Did you the latest changes on the computer?

    You can check if changing the resolution of the screen helps you solve the problem. See below for links-

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-screen-resolution

    http://Windows.Microsoft.com/en-us/Windows-Vista/getting-the-best-display-on-your-monitor

     

    You can also check if the setting parameters of monitor, referring to the manual of the monitor will help you.

     

    I hope this helps.

  • Performance problem on the SQL query that does not use the primary key index

    Hello!

    I have some performance issues on a single SQL query (Oracle 10 g).
    I could solve the problem by using the INDEX indicator, but I would like to know WHY this is happening.

    * Tables *.
    create table jobs)
    ID number (5) not null,
    name varchar2 (100),
    primary key constraint Job_PK (id)
    )
    /
    -Record count: 298

    create table Comp)
    integer ID not null,
    name varchar2 (100),
    primary key constraint Comp_PK (id)
    )
    /
    -Record count: 193

    -Relation m: n
    create table JobComp)
    integer ID not null,
    id_job integer not null,
    id_comp integer not null,
    primary key constraint JobComp_PK (id),
    unique key constraint JobComp_UK (id_job, id_comp),
    Constraint JobComp_FK_Job foreign key (id_job) refers to Job (id),
    Constraint JobComp_FK_Comp foreign key (id_comp) makes reference Comp (id)
    )
    /
    create index JobComp_IX_Comp on JobComp (Cod_Comp)
    /
    create index JobComp_IX_Job on JobComp (Cod_Job)
    /
    -Record count: 6431

    * Ask *.

    When I run this query, the execution plan shows the index using (JobComp_PK and JobComp_IX_Comp).
    No problem.

    Select JobComp.*
    of JobComp
    Join jobs
    on Job.id = JobComp.id_job
    where JobComp.id_comp = 134
    /
    -runs in 0.20 sec

    But when I add the field 'name' of the work table the plan uses full access table to the table of work

    Select JobComp.*, Job.name
    of JobComp
    Join jobs
    on Job.id = JobComp.id_job
    where JobComp.id_comp = 134
    /
    -runs in the 2.70 dry

    With the help of the index

    Select / * + INDEX (Job Job_PK) * /.
    JobComp.*, Job.name
    of JobComp
    Join jobs
    on Job.id = JobComp.id_job
    where JobComp.id_comp = 134
    /
    -runs in 0.20 sec

    * Doubt *.

    This behavior is correct?

    PS. : I tried to recalculate the statistics, but nothing changes:

    analyze the job calculation table statistics.
    /
    change the statistical calculation of index Job_PK reconstruction;
    /
    Start
    dbms_utility.analyze_schema (sys_context ('userenv', 'current_schema'), 'CALCULATE');
    end;
    /

    [of]
    Gustavo Ehrhardt

    Gus.EHR wrote:
    Hello.
    I'm sorry for the plan unformatted.
    The execution time of the querys "without field name' and 'with the field name with suspicion" are equal.
    He has no problem caching, because I get the plans of the sequence different from the querys and repeated the performance. The result is always the same.

    I don't think that there is no problem with oracle crossing LOOP IMBRIQUEE to the HASH JOIN when you include the field name and this should be the expected behavior. But it seems that your WORKING table has a degree of parallelism set against what is causing the query to run in parallel (as JOB table is now available with full table scan, instead of indexed access earlier). It could be that the parallel execution is contributor to extra Runtime.
    (a) do you know why the degree of parallelism on the WORK table has been defined? Do you need it?

    You can see if the following query provides a better response time?

    select /*+ NOPARALLEL(JOB) */ JobComp.*, Job.Name
      from JobComp
      join Job
        on Job.id = JobComp.id_job
     where JobComp.id_comp = 134
    
  • If the INSTR function will not use the INDEX o?

    Hi all


    I have a querry as
        Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0 ;
    Is simple index on column Col1. If we use the index will be used or full table scan will happen in this scenario?

    Please give me explanatory answer because I have doubts


    Dhabas

    Hello

    You must use the index function if you want to avoid the full table scan. Check this box

    SQL> create table tab1(col1 varchar(20))
      2  /
    
    Table created.
    
    SQL> insert into tab1 values ('XXAB')
      2  /
    
    1 row created.
    
    SQL> create index col1_idx on tab1(col1);
    
    Index created.
    
    SQL> explain plan for Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0;
    
    Explained.
    
    SQL> set autotrace on
    SQL> Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0;
    XXAB
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5 Card=1 Bytes=12)
       1    0   TABLE ACCESS (FULL) OF 'TAB1' (TABLE) (Cost=5 Card=1 Bytes
              =12)
    
    Statistics
    ----------------------------------------------------------
              4  recursive calls
              0  db block gets
             32  consistent gets
              0  physical reads
              0  redo size
            234  bytes sent via SQL*Net to client
            280  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    
    SQL>  create index col1_idx2 on tab1(Instr(Col1,'XX'));
    
    Index created.
    
    SQL> Select * from Tab1 Where Instr(Tab1.Col1,'XX') >0;
    XXAB
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1 Bytes=12)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'TAB1' (TABLE) (Cost=2 Ca
              rd=1 Bytes=12)
    
       2    1     INDEX (RANGE SCAN) OF 'COL1_IDX2' (INDEX) (Cost=1 Card=1
              )
    
    Statistics
    ----------------------------------------------------------
             28  recursive calls
              0  db block gets
             22  consistent gets
              0  physical reads
              0  redo size
            234  bytes sent via SQL*Net to client
            280  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    
    SQL> 
    

    Thank you
    AJ

  • Why Adobe does not use the codec x264vfw open source for things like. AVI?

    Well we all know who wants to work with the x264vfw that does work in Premiere Elements.

    But I think Adobe might have to operate with the open source x264vfw or AVC-Intra coding Manager.

    I'm still wonder as to why it would work when I re - encode with another program to h264 in MP4 but again?

    Adobe goes really easy and messing with us. because they say there is support for h264 but only for MP4 and the other...

    Why they do not add. Support AVI, which goes to support of Adobe because I can't enter the livechat... because it is only of the week...

    This Codec the H264, X 264 and STROKE-1 are the most used codecs today, in my opinion, so I don't know why they don't sit their dev on it.

    It does not work on their $ 600 Application named Premiere Pro is something I do not understand...

    For me its amazing if I'm honest.

    Now, I want to know why adobe is such a service at this point.

    They all scream it, but Adobe does nothing.

    If someone knows a solution without re-encoding or FFMPEG, because it works well with my Variable rate in Premiere Elements let me know.

    Also, I want a response from Adobe, why they do nothing.

    I tried to put in plugins x264vfw .dll file or the folder, but the problem is not resolved.

    I sit to keep quiet for a while behind that and see how much son he existing... and it is more frustrating.

    ADOBE, it's time to do something!

    Sergadra

    As said, Adobe is the only one who can answer the type of questions you may have. And he does not here.

    Out of curiosity, I ask "have you contacted other manufacturers of video editing software and have been able to get the.

    Why answers to its marketing and strategy of the function defined for its current versions or future?

    Adobe feature/bug report form and a wait and see seems to be your opportunity of Adobe in this respect. So, you wait and see

    If your suggestion is coming in the next version. I'm not criticizing, just reporting what seems to be the 'what. '

    RTA

  • query not using the index for some user

    Hello

    I have a query that is running in less than a second for sys, system, or schema owner. However, another user (test_user) take 30 seconds to run the same query.

    I certainly dba and privileges identical to test_user as schmea_user, but the result is the same.

    I checked

    Select * from V$ SYS_OPTIMIZER_ENV;

    Both are the same for both users.

    I have check the plan to explain to both users. I noticed that for sys/system/schema_owner, the query uses an index, but not the test_user.

    All have experience the issue where a user uses an index, but not the other?

    Thank you for any assistance.

    Thank you for the display of formatting output, this output is much easier to read.

    One of the first things you notice about the execution plans that is for the owner non-schema "SQL_ID, 0wcs85uywn72m, number of children 1" appears in the output of DBMS_XPLAN, while "SQL_ID 0wcs85uywn72m, child number 0" (the same SQL_ID but a different number of child) appears for the schema owner. "" Whereas the SQL_ID is the same, which indicates that the client requires exactly the same SQL statement, so it's a good start.

    Then, note that in the predicate for the nonschema owner information section the following appears (sometimes with the order of the two conditions switched in position) as a condition placed on each table that is available in the schema:

    filter(("SEAL_FLAG" IS NULL OR "SEAL_FLAG"'Y'))
    

    The above suggests the presence of the virtual private database (or a superset of private database virtual) generated the predicates. You should be able to confirm that this is the case by querying V$ VPD_POLICY using the SQL_ID which was displayed in the DBMS_XPLAN output:

    SELECT
      *
    FROM
      V$VPD_POLICY
    WHERE
      SQL_ID='0wcs85uywn72m';
    

    As a test, I made a few minor adjustments to the example on this page:
    http://Antognini.ch/2011/09/optimizer_secure_view_merging-and-VPD/
    I changed the name of T to T12 and TESTUSER table specified for the schema names. I then created the function S of this page as follows:

    CREATE OR REPLACE FUNCTION s (schema IN VARCHAR2, tab IN VARCHAR2) RETURN VARCHAR2 AS
    BEGIN
      RETURN 'ID < 10';
    END;
    /
    

    I then added a couple of lines in the T12 test table:

    INSERT INTO T12 VALUES (1,1,NULL);
    INSERT INTO T12 VALUES (4,1,NULL);
    INSERT INTO T12 VALUES (10,1,NULL);
    INSERT INTO T12 VALUES (12,1,NULL);
    
    COMMIT;
    

    With an active 10053 trace, I executed the following SQL statement:

    SELECT id, pad
      FROM t12
      WHERE
      spy(id, pad) = 1
    

    The SQL_ID (in my case, found in the 10053 trace file) was 6hqw5p9d8g8wf, so I checked V$ VPD_POLICY to this SQL_ID:

    SELECT
      *
    FROM
      V$VPD_POLICY
    WHERE
      SQL_ID='6hqw5p9d8g8wf';
    
    ADDRESS          PARADDR            SQL_HASH SQL_ID        CHILD_NUMBER OBJECT_OWNER OBJECT_NAME                    POLICY_GROUP                   POLICY                 POLICY_FUNCTION_OWNER          PREDICATE
    ---------------- ---------------- ---------- ------------- ------------ ------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ ------------------------------------------------------------------------------------
    000007FFB7701608 000007FFB7743350 1518838670 6hqw5p9d8g8wf            0 TESTUSER     T12                            SYS_DEFAULT                    T_SEC                  TESTUSER                       ID < 10
    

    As noted above, the VPD test function named S added the predicate "ID".< 10"="" to="" the="" sql="">

    There are not many clues in the 10053 trace file in my test VPD generated additional predicates. Trace the following was found shortly after the beginning of the file (this is the SQL statement initially presented):

    ----- Current SQL Statement for this session (sql_id=6hqw5p9d8g8wf) -----
    SELECT id, pad
      FROM t12
      WHERE
      spy(id, pad) = 1
    

    I searched then down in the trace for final after changes query file (to be noted that this sentence could be slightly different in different versions of database Oracle). That's what I found:

    Final query after transformations: ******* UNPARSED QUERY IS *******
    SELECT "T12"."ID" "ID","T12"."PAD" "PAD" FROM "TESTUSER"."T12" "T12" WHERE "TESTUSER"."SPY"("T12"."ID","T12"."PAD")=1 AND "T12"."ID"<10
    kkoqbc: optimizing query block SEL$F5BB74E1 (#0)
    

    Note that the final query after transformation shows how the final version of the query that has been rewritten by the query optimizer before the SQL statement has been executed and this version of the query includes AND "T12". "" IDENTITY CARD ".<10. if="" i="" was="" attempting="" to="" determine="" how="" that=""><10 predicate="" was="" added="" to="" the="" sql="" statement,="" i="" would="" start="" at="" the="" "current="" sql="" statement="" for"="" line="" in="" the="" trace="" file="" and="" search="" down="" the="" trace="" file="" for=""><10* -="" in="" this="" case,="" the="" following="" is="" what="" i="" found="" as="" the="" first="" search="" result,="" very="" close="" to="" the="" "current="" sql="" statement="" for"="" line="" in="" the="" trace="">

    **************************
    Predicate Move-Around (PM)
    **************************
    PM:     PM bypassed: Outer query contains no views.
    PM:     PM bypassed: Outer query contains no views.
    query block SEL$F5BB74E1 (#0) unchanged
    FPD: Considering simple filter push in query block SEL$F5BB74E1 (#0)
    "TESTUSER"."SPY"("T12"."ID","T12"."PAD")=1 AND "T12"."ID"<10
    try to generate transitive predicate from check constraints for query block SEL$F5BB74E1 (#0)
    finally: "TESTUSER"."SPY"("T12"."ID","T12"."PAD")=1 AND "T12"."ID"<10
    

    As can be seen from the above (because the predicate again appeared before and after the line containing the word "Finally: '), the AND"T12 ". "" IDENTITY CARD ".<10 predicate="" was="" already="" added="" to="" the="" original="" sql="" statement="" by="" the="" time="" the="" predicate="" move-around="" section="" of="" the="" trace="" file="" was="" written,="" and="" that="" is="" the="" first="" mention="" of=""><10 in="" the="" trace="" file.="" in="" your="" case,="" you="" would="" search="" the="" 10053="" trace="" file="">

    "SEAL_FLAG" IS NULL
    

    If V$ VPD_POLICY revealed that there are virtual private database (VPD) generated predicates applied to the SQL statement, take a look at the following article in the Oracle documentation library:
    http://docs.Oracle.com/CD/B28359_01/network.111/B28531/VPD.htm

    This article lists the different points of view, who can be interviewed to learn more about the VPD rules which are in force in the schema. For example, with my SPV test:

    SELECT
      *
    FROM
      ALL_POLICIES;
    
    OBJECT_OWNER                   OBJECT_NAME                    POLICY_GROUP                  POLICY_NAME                    PF_OWNER                       PACKAGE                       FUNCTION                       SEL INS UPD DEL IDX CHK ENA STA POLICY_TYPE              LON
    ------------------------------ ------------------------------ ----------------------------- ------------------------------ ------------------------------ ----------------------------- ------------------------------ --- --- --- --- --- --- --- --- ------------------------ ---
    TESTUSER                       T12                            SYS_DEFAULT                   T_SEC                          TESTUSER                       S                                                            YES YES YES YES NO  NO  YES NO  DYNAMIC                  NO
    

    He knows performance issues related to the use of VPD, some of which are Oracle Database version-dependent, and some have been fixed in recent versions. Take a look at the following articles if you have access to My Oracle Support:
    MetaLink (MOS) Doc ID 728292.1 ' known performance problems when you use transparent encryption data and indexes on the encrypted columns.
    MetaLink (MOS) Doc ID 967042.1 "How to investigate Query Performance regressions Caused by VPD (FGAC) predicates?"

    You might find working through the second of the above that the problem is caused by a bug in database Oracle.

    On a side note. Execution plans you have published include the 0 value in the column starts many of the operations in the execution plan. 0 indicates that the operation never actually executed. A 0 is included in the column starts on the line that includes the FULL ACCESS of TABLE of PEOPLE_TRANSACTIONS at least to the OPC. Value 123, a full table of PEOPLE_TRANSACTIONS table scan PROPERTY_CONTAINER_ID was not actually performed.

    Charles Hooper
    http://hoopercharles.WordPress.com/
    IT Manager/Oracle DBA
    K & M-making Machine, Inc.

  • custom validator does not use the property

    Hello

    I need a validator that validates the entries based on a search in a database. So I created a class that implements the validator. I also inject dao via the property in faces - config.xml, but I do not see the method is called, even if it's public. So I get a NullPointerException on the validate method. What I am doing wrong?

    <>validator
    my.customValidator < validator-id > < / validator id >
    > class validator < org.company.jsf.validator.CustomValidator < / validator-class >
    < property >
    > property name < theDao < / property-name >
    > class property < #{theDao} < / class property >
    < / property >
    < / validator >

    Thank you
    Dave

    I expect 'property-class' classname real being with a complete package of your DAO. It is not a managed bean named "theDAO" JSF, so you can't inject. But why not just build in your support bean, I wonder?

    If it's really a JSF managed bean somehow, you would inject it like this:

          
            theDAO
            #{theDAO}
          
    

    So, using the value attribute.

  • Do not use the index

    Hi all
    DB version is 10.2.0.4
    Have a query as below
    SQL> explain plan for SELECT GS.LOT_NO , GS.LOT_ID , ILI.ITEM_ID ITEM_ID,
      2               GR.RESULT_VALUE_CHAR QUALITATIVE_VALUE , ITM.ITEM_NO FROM
                 GMD_QC_TESTS GQT, GMD_RESULTS GR, GMD_SAMPLES GS , IC_LOCT_INV
      3    4               ILI, IC_ITEM_MST_B ITM WHERE GQT.TEST_CODE = 'ISON' AND
      5               GR.TEST_ID = GQT.TEST_ID AND GR.RESULT_VALUE_CHAR LIKE :B3
      6               ||'-'||:B2 ||'%' AND GR.SAMPLE_ID = GS.SAMPLE_ID AND ITM.ITEM_ID
      7               = GS.ITEM_ID AND ILI.WHSE_CODE = UPPER(:B1 ) AND ILI.ITEM_ID =
      8               GS.ITEM_ID AND ILI.LOT_ID = GS.LOT_ID AND ILI.LOCT_ONHAND > 0
      9               AND ILI.LOT_ID > 0 AND ILI.LOT_STATUS = 'GOOD' AND NOT EXISTS (
     10               SELECT 1 FROM IC_TRAN_PND ITP WHERE ITP.LOT_ID = GS.LOT_ID AND
     11               ITP.ITEM_ID = GS.ITEM_ID AND ITP.DELETE_MARK = 0 AND
     12               ITP.DOC_TYPE = 'OMSO' AND ITP.WHSE_CODE = UPPER(:B1 ) AND LOT_ID
     13               <> 0 ) ORDER BY 4
     14  /
    
    Explained.
    
    SQL> select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 2952119331
    
    ---------------------------------------------------------------------------------------------------------
    | Id  | Operation                          | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                   |                    |    55 |  7095 | 13614   (1)| 00:02:51 |
    |   1 |  SORT ORDER BY                     |                    |    55 |  7095 | 13614   (1)| 00:02:51 |
    |   2 |   NESTED LOOPS ANTI                |                    |    55 |  7095 | 13613   (1)| 00:02:51 |
    |   3 |    NESTED LOOPS                    |                    |    55 |  5940 | 13393   (1)| 00:02:49 |
    |*  4 |     HASH JOIN                      |                    |    55 |  4730 | 13283   (1)| 00:02:47 |
    |*  5 |      TABLE ACCESS BY INDEX ROWID   | IC_LOCT_INV        | 17498 |   410K|  4056   (1)| 00:00:51 |
    |*  6 |       INDEX RANGE SCAN             | IC_LOCT_INV_I1     | 52570 |       |   137   (0)| 00:00:02 |
    |*  7 |      HASH JOIN                     |                    | 14944 |   904K|  9226   (1)| 00:01:56 |
    |   8 |       NESTED LOOPS                 |                    | 14944 |   452K|   212   (0)| 00:00:03 |
    |   9 |        NESTED LOOPS                |                    |     1 |    19 |     2   (0)| 00:00:01 |
    |  10 |         TABLE ACCESS BY INDEX ROWID| GMD_QC_TESTS_B     |     1 |    12 |     2   (0)| 00:00:01 |
    |* 11 |          INDEX UNIQUE SCAN         | GMD_QC_TESTS_B_U1  |     1 |       |     1   (0)| 00:00:01 |
    |* 12 |         INDEX UNIQUE SCAN          | GMD_QC_TESTS_TL_PK |   508 |  3556 |     0   (0)| 00:00:01 |
    |  13 |        TABLE ACCESS BY INDEX ROWID | GMD_RESULTS        | 14944 |   175K|   210   (0)| 00:00:03 |
    |* 14 |         INDEX RANGE SCAN           | GMD_RESULTS_N3     |   228 |       |     3   (0)| 00:00:01 |
    |* 15 |       TABLE ACCESS FULL            | GMD_SAMPLES        |  1642K|    48M|  9007   (1)| 00:01:54 |
    |  16 |     TABLE ACCESS BY INDEX ROWID    | IC_ITEM_MST_B      |     1 |    22 |     2   (0)| 00:00:01 |
    |* 17 |      INDEX UNIQUE SCAN             | IC_ITEM_MST_B_PK   |     1 |       |     1   (0)| 00:00:01 |
    |* 18 |    TABLE ACCESS BY INDEX ROWID     | IC_TRAN_PND        |     1 |    21 |     4   (0)| 00:00:01 |
    |* 19 |     INDEX RANGE SCAN               | IC_TRAN_PNDI1      |     1 |       |     3   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------------------
    In the table full scan that happens on GMD_SAMPLES. Lot_id is selected in this table. On this column, there are indexes in the table. But this is not used?
    SQL> select dbms_metadata.get_ddl('INDEX','GMD_SAMPLES_N3','GMD') from dual;
    
      CREATE INDEX "GMD"."GMD_SAMPLES_N3" ON "GMD"."GMD_SAMPLES" ("LOT_ID")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "APPS_TS_TX_DATA"
    How can I lower the cost of the query. ?. This query runs for more than two hours in the comic book...

    Thank you
    Baskar.l

    The counties to answer your question, now?
    LOT_ID returns 99 + % of the lines so Full Table Scan is 100% justified & more efficient execution plan

  • Photoshop does not use the value amount of ram. Stuck at 6 GB

    Hey guys, recently started having issues with photoshop do not receive the fixed amount of ram needed. I have it set to use 24 GB of Ram (I have 32 GB) tried a reset, tried to reset back to the factory, then put it back, nothing. The strange thing is that if I put it to use only 1 GB of ram, it is still idling to 6 GB. Advice on how to approach this would be greatly appreciated I during the execution of projects that require a lot of attention.

    Thank you.

    Mac or Win?

    If you give complete and detailed information on your configuration and the matter in dispute, such as your platform (Mac or Win), exact versions of your operating system, Photoshop and bridge, specification of the machine, what troubleshooting steps you have taken so far, what you receive error messages if problems with opening files raw as the exact camera brand and model that generated the , etc, someone may be able to help.

    Read this FAQ to get advice on how to ask your questions correctly to get faster and better answers:

    http://forums.Adobe.com/thread/419981?TSTART=0

    Thank you!

  • 1.5.4 - SQL-spreadsheet SQL-Developer does not use the owner of the Table

    In older versions of the sql developer, you can remove a table in the spreadsheet and was built a select query. With the new version 1.5.4 - owner of the table is ' % s ' and you must inform the owner of the table or the query does not work with tables of other users.

    Is this a bug or is there the possibility to change the settings to delete tables in the SQL-worksheet with the owners of the table.

    You're DND from the node of the Table under the node of the other user? If so, I'm able to reproduce the problem you're talking about. Otherwise I still not got you problem clearly.

  • Why print does not use the default printer?

    I have two main printers to use at home and whenever I print a web page, Firefox will automatically print using the default printer. If I select the default printer from the drop-down list, it works very well. I wouldn't select the printer by default every time I want to print.

    Try of the reset described here for print.print_printer preference:

    http://KB.mozillazine.org/Problems_printing_web_pages#Reset_printer

  • Premiere Pro does not use the power of the nucleus for the rendering of chronology

    I had PremierePro CS5.5 and i7 920 and nvidia GTX 295. When I edit my images (cineform) everything is fine because I use CUDA boost, but when I try to restore the timeline I have seen on my CPU and GPU that rendered monitor uses maybe about 10% of the power of all hearts (8 cores). How to use the full power of the carrots when I went to my calendar?

    Project > project settings > general

Maybe you are looking for

  • Satellite 5200-801-indicator of battery flashes orange while dc is green

    I have SATELLITE 5200-801, the battery light flashes orange while the domain controller is green and the laptop worksstop when it is off.the battery is empty. I can't boot from external USB cdrom to install windows as its internal DVD does not work H

  • Two versions of Tempro preinstalled on my laptop

    All new Satellite Pro C50 - has with Windows 7 Pro 64-bit pre-installed.After a few minutes, a "32-bit Tempro" window opens and asks me if I want to activate it.Ok.But then, I find that there is a second "Tempro' utility as well. No 32, so I guess th

  • Satellite U400-138 - how to activate special keys?

    Hello the problem for the subject [Satellite U400 - 138 Volume - software problem wheel | http://forums.computers.toshiba-europe.com/forums/thread.jspa?messageID=148001] I found a stupid bug in the software Toshiba Satellite U400-138 special keys. Th

  • Boolean link in the different tab control buttons

    Well guys, I know not is a very simple question, but I don't know how to do it! I have a button that control something in a tab control, and I need to put the same key, making the same function in another tab control, how can I do this? Like bond wit

  • Email account is send ads to people on my list and I'm not logged in!

    I was called by a couple of contacts to let me know that they have received emails (that I had not sent). They are my account Windows Live and no topic, but when the e-mail message is opened it is for an ad. My concern is that now my password may be