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

Tags: Database

Similar Questions

  • 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
    
  • 11g R2 optimizer is not using indexes

    I have the table named OPT_TEST in my database 11g R2.
    There is an index on the ename column of the table above.
    11g does not use this index when I ask above table on the basis of the ename column.

    SQL > select count (*) in the opt_test;

    COUNT (*)
    ----------
    851969

    SQL > select count (*) in the opt_test where ename = 'KING '.

    COUNT (*)
    ----------
    1

    SQL > exec dbms_stats.gather_table_stats ('SCOTT', 'OPT_TEST', method_opt = > 'for all columns size skewonly');

    SQL > explain plan for select * from opt_test where ename = 'KING '.

    He explained.

    SQL > select parent_id, operation, options, object_name, id, io_cost from plan_table;

    ID PARENT_ID OPERATION OPTIONS OBJECT_NAME IO_COST
    ---------- ---------- ------------------------------ ------------------------------ ------------------------------ ----------
    0 SELECT STATEMENT 1365
    1 0 TABLE ACCESS FULL OPT_TEST 1365


    There is on one employee with the name 'KING' in the OPT_TEST table.
    I have also generated stats on the table and the index but still optimizer makes complete analysis.

    user8916506 wrote:

    SQL> select count(distinct ename) from opt_test ;
    
    COUNT(DISTINCTENAME)
    --------------------
    14
    
    SQL> select ename,count(*) from opt_test  group by ename;
    
    ENAME        COUNT(*)
    ---------- ----------
    ALLEN           65536
    JONES           65536
    FORD            65536
    CLARK           65536
    MILLER          65536
    SMITH           65536
    WARD            65536
    MARTIN          65536
    SCOTT           65536
    TURNER          65536
    ADAMS           65536
    BLAKE           65536
    KING                1
    JAMES           65536
    
    14 rows selected.
    

    The answer is b - I thought of:
    You enabled Oracle to make a sample auto size, and he stopped on a very small sample because he thought that he had obtained a stable result. But he has never seen the line after line with KING. Therefore, when you query for KING oracle saw "not in the histogram. For versions of Oracle 10.2.0.3 beyond estimation is then "half the number of lines for the least popular value', which comes to 32 768.

    Concerning
    Jonathan Lewis

  • 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.

  • Lightroom does not use my gpu and it says it is compatible, and the driver is updated, what do I do now?

    Lightroom does not use my gpu and it says it is compatible, and the driver is updated, what do I do now?

    As far as I could see, your card supports OpenGL 3.2 only that OpenGL 3.3 is necessary.

  • Visual Query Builder does not work

    I use the ColdFusion Flex Builder 3 (3.0.1.205647) extensions, and I can't use the Visual Query Builder. This is a new installation for ColdFusion8. I have configured RDS, I even test the connection successfully.

    I can use the RDS DataView and see the databases, click cfartgallery, for example and see the facility 'art' content of the table. No problem. Then I click the button of "Visual Query Builder", and nothing happens. The query designer does not appear.

    It's not a big problem until I have try running the CF/Ajax application wizard and edit the page master is supposed to open query... Builder even problem. Same here, it will not open. So I can't change anything or use the wizards at all. I get no error message, it just does nothing when I click on the button.

    Does anyone else have this problem? Is there a setting I'm missing or need to set up after a new installation in the CF administrator?

    Using vista?

    Click Flex and then click on run as administrator

    --
    Ken Ford
    Adobe Community Expert Dreamweaver/ColdFusion
    Fordwebs, LLC
    http://www.fordwebs.com

    "adimauro" wrote in message
    News:g8pt2n$JH1$1@forums. Macromedia.com...
    > I use the ColdFusion Flex Builder 3 (3.0.1.205647), and
    > I
    > cannot use the Visual Query Builder. This is a new installation for ColdFusion8. I have
    > have
    > RDS set up, I even test the connection successfully.
    >
    > I can use the RDS DataView and see the databases, click cfartgallery,.
    > for
    > contents of the example table and the exhibition 'art '. No problem. Then I click on the
    > "Visual Query Builder" button and nothing happens. The query designer is
    > not
    > show.
    >
    > It's not a big deal, until I have try running the CF/Ajax application wizard, and
    > edition
    > the master page is supposed to open the Query Builder... same problem.
    > Even
    > here it does not open. So I can't change anything or use the wizards at all. I have
    > don't get any what error message, it just does nothing when I click on the
    > button.
    >
    > Someone else has this problem? Is there a setting I am missing or have
    > to
    > set up after a new installation in the CF administrator?
    >

  • View does not use index Mview underlying but mview uses indexes

    Hello

    I faced a situation where, while querying data to display based on mview does not use the index, but when we wonder of mview it uses index and produce quick results.

    Here are the details:

    
    querying from view: (completes in more than a minute even after passing hint)
    ================================
    explain plan for select /*+ index(  ITGI_CREDITOR_LEDGER_CMV ITGI_CREDITOR_LEDGER_INDX) */ * from CR_LEDGER_REP_V where vendor_id='1474911';
    
    Plan hash value: 463951623
    
    ---------------------------------------------------------------------------------------------------
    | Id  | Operation              | Name                     | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT       |                          |  9056K|  5648M| 97644   (1)| 00:00:04 |
    |*  1 |  VIEW                  | CR_LEDGER_REP_V          |  9056K|  5648M| 97644   (1)| 00:00:04 |
    |   2 |   COUNT                |                          |       |       |            |          |
    |   3 |    MAT_VIEW ACCESS FULL| ITGI_CREDITOR_LEDGER_CMV |  9056K|  2159M| 97644   (1)| 00:00:04 |
    ---------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter("VENDOR_ID"=1474911)
    
    
    
    Querying from mview: (completes within a second)
    ==============================
    
    explain plan for select /*+ index(  ITGI_CREDITOR_LEDGER_CMV ITGI_CREDITOR_LEDGER_INDX) */ * from ITGI_CREDITOR_LEDGER_CMV where vendor_id='1474911';
    
    
    Plan hash value: 1726512073
    
    --------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                              | Name                      | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                       |                           |    21 |  5880 |    21   (0)| 00:00:01 |
    |   1 |  MAT_VIEW ACCESS BY INDEX ROWID BATCHED| ITGI_CREDITOR_LEDGER_CMV  |    21 |  5880 |    21   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN                     | ITGI_CREDITOR_LEDGER_INDX |    22 |       |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("VENDOR_ID"=1474911)
    
    
    
    View DDL
    ========================
    
    CREATE OR REPLACE FORCE VIEW SANJAY.CR_LEDGER_REP_V
    (
       QRY,
       SR_NO,
       VENDOR_ID,
       VENDOR_TYPE,
       VENDOR_NUMBER,
       VENDOR_NAME,
       VENDOR_SITE_ID,
       VENDOR_SITE_CODE,
       GL_DATE,
       ACCOUNTING_DATE,
       PO,
       INVOICE_TYPE,
       AP_INVOICE_NO,
       INVOICE_DOC_CAT,
       AP_INVOICE_DATE,
       INVOICE_VOUCHER_NO,
       PAYMENT_VOUCHER_NO,
       CHQ_NO,
       DESCRIPTION,
       PAYMENT_DATE,
       ACC_CODE,
       PAYMENT_METHOD,
       CURR_CODE,
       DEBIT,
       CREDIT
    )
    AS
       SELECT qry,
              ROWNUM srn,
              vendor_id,
              vendor_type_lookup_code,
              vendor_no,
              vendor_name,
              vendor_site_id,
              vendor_site_code,
              gl_date,
              accounting_date,
              po_distribution_id,
              invoice_type_lookup_code,
              invoice_num,
              doc_category_code,
              invoice_date,
              inv_voucher_num,
              payment_num,
              check_number,
              description,
              pay_accounting_date,
              account_code,
              payment_method_code,
              invoice_currency_code,
              debit,
              credit
         FROM sanjay.itgi_creditor_ledger_cmv;
    
    
    
    

    The plan does not change even if I do not use advice.

    Although I said developer to use mview directly, but I did not understand this behavior.

    DB version: 12.1

    OPERATING SYSTEM: AIX 6.1

    Kind regards

    Gerard

    Note that the query on the view plan is only to apply your filter predicates on line 1, rather than against the mview in line 3. Line 2 said you that enforcement must correspond to a kind of County before it can filter which is due to the virtual rownum in your point of view.

    You need this column? In my opinion, it's meaningless. Remove the column from the view would mean that the view doesn't have to be assessed in its entirety (if not, how it will calculate rownums?) before allowing you to filter. You asked the developer to implement the work is likely to come with a different value of sr_no (if the developer is even using it?) than what he would have obtained by using the view.

    The column tries to catch a unique key for the view? Are you aware that rownum values can and will change between requests to the same table as the order lines are selected is not guaranteed. If the column is actually useful (and it is correct to calculate at this level) you then could it sense it is calculated inside the mview? This means that you can only refresh the mview completely and rownum values can (and will) only change on refresh.

  • Why color Temp does not use theory standard blackbody in lightroom?

    Hi all, I would like to ask a question. Why the temperature in Lightroom does not use theory standard blue witch bsigns black body for higher values and the red ones for lower values on the kelvin color temperature scale?

    I'm not a novice and a motion graphic designer and 3D generalist and I do not understand why the Lightrooms does not use the normal scale. You go to a 3D ap and if you are familiar with lightroom you will have some problems whit lighthning because in all the 3d points and from what I've seen other counters aps use the kelvin color temperature values, higher values are asigned to blue spectrum. For example, with a bulb (D65) of natural light has a value of 2700 Kelvin is the red color red but in lightroom is on the opposite side and 2700 you have a tint of blue. I personally find very annoing this approach and I would like to ask Adobe if they could put an option to change the color temperature scale Kelvin standard.

    Thank you

    http://en.Wikipedia.org/wiki/Color_temperature

    Cursors do not set the light black body temperature, but compensation requested the image to compensate for the temperature of the black body of light.  This is going the other way.

    If a picture is taken in tungsten (light that is yellow-ish), we always want to look white 'white' when view us on a screen (as our eyes compensate for the color temperature of the ambient lighting).  To adjust to the lighting low temp black body (i.e. yellow-ish), so we want to make the image more blue, so it does not yellow.  Until the lower part of the blackbody temp lighting (i.e. more yellow enlightenment), the more blue the compensation that we must apply.

  • Firewall Windows does not use recommended settings

    Firewall service Windows is not running: does not use recommended settings

    Firewall service Windows is not running: does not use recommended settings

    Please specify:
    > windows firewall service is not running
    > does not use recommended settings

    If it running or NOT?
    Which of the above is the problem?

    RE: windows firewall service does not

    Start button > in the search box, type services > press the Enter key > scroll down to Windows Firewall and click on it...
    under the State column, it must be said... started
    under the Startup Type column, I must say... Automatic

    If it does not say that, right click on Windows Firewall > click Properties > make the changes.

    RE: does not use recommended settings

    Start button > in the search box, type windows firewall > looks upward at the top on the left, click on Windows Firewall > click on change settings > put on a blue radio point (recommended) level > OK for the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • 0 x 80070422 windows firewall does not use recommended settings to help protect your computer

    Hello, I kepp getting this firewall of windows message 0 x 80070422 does not use recommended settings to help protect your computer,.

    Whenever I click on the recommended use of the parameters, it gives me this code. I ran virus and malware scans and I foud more but now they have been removed. But still, I'm afraid that I don't have a wall of fire and that anthing can pass through.

    If anyone can give me some advice it would be greatly appreciated.

    Marko7

    Hello

    Run an online scan to check any virus or any other malicious software:
    http://OneCare.live.com/site/en-us/default.htm

    and see here

    Error code 0 x 80070422 cannot activate the firewall

    I would like to know if this helps
    Elvis

  • Tablespace does not use a certain data file

    Hi all, I am new to Oracle DB. Reported by developer that storage space is full, and then I found that there are two data files associated with the storage space by checking dba_data_files. The first data file size is already full of 32GB, and the second is 8GB. However, it seems that the tablespace does not use the data file second when I check the free space of the tablespace because I cannot find its use. That's why Oracle DB shows ORA-01654 and tell me to add another data file. I fix this by adding another data file. But I'm just wondering why it seems that the tablespace does not use the second data file, I checked the status of second in the data file is online of v$ datafile. Could someone give me an idea about this problem? Thank you very much.

    c115bca7-E432-460f-a0c5-273b2157dcbe wrote:

    Hi all, I am new to Oracle DB. Reported by developer that storage space is full, and then I found that there are two data files associated with the storage space by checking dba_data_files. The first data file size is already full of 32GB, and the second is 8GB. However, it seems that the tablespace does not use the data file second when I check the free space of the tablespace because I cannot find its use. That's why Oracle DB shows ORA-01654 and tell me to add another data file. I fix this by adding another data file. But I'm just wondering why it seems that the tablespace does not use the second data file, I checked the status of second in the data file is online of v$ datafile. Could someone give me an idea about this problem? Thank you very much.

    1 cause the second data file - is not activate with auto-extend and its fixed size, 8 GB, which could deliver the extensions are not free - filled and that you may not able to find any free extends from dba_free_space
    2. Please activate auto extend for this data file and add the new data file based on space allocation.

    -Pavan Kumar N

  • Hello, "set as Start Page" does not work for me. Anyone has any idea why?

    My "set as Start Page" does not work... anyone know what I can do?

    Thank you!!

    So, you tried to set the homepage under areas of site?

    What is now your start page?

  • ORA-16797: database does not use a server parameter file

    I can see newspapers apply pending data. But in the dataguard alter journal generates error ORA-16797: database does not use a server parameter file

    Error message in the logfile dataguard
    -----------------------------------

    DG 2010-03-23-17: 0 2 714415739 MICHAEL 46:45: GET_DRC finished
    DG 2010-03-23-17: 714415740 3 1000000 MICHAEL 46:45: GET_SITE: success. (len = 464)
    DG 2010-03-23-17: 714415740 3 1000000 MICHAEL 46:45: GET_SITE finished
    DG 2010-03-23-17: 2000000 3 714415741 MICHAEL 46:45: GET_SITE: success. (len = 481)
    DG 2010-03-23-17: 2000000 3 714415741 MICHAEL 46:45: GET_SITE finished
    DG 2010-03-23-17: 0 2 714415742 MICHAEL 46:45: CTL_GET_STATUS sent to the ANZPRD site for treatment
    DG 2010-03-23-17: 0 2 714415742 MICHAEL 46:45: CTL_GET_STATUS finished
    DG 2010-03-23-17: 47:32 0 2 0 RSM0: HEALTH CHECK ERROR: ORA-16797: database does not use a server parameter file
    DG 2010-03-23-17: 47:32 0 2 704706097 CTL_GET_STATUS operation cancelled during phase 1, error = ORA-16797
    DG 2010-03-23-17: 47:32 0 2 704706097 CTL_GET_STATUS operation cancelled during phase 1, error = ORA-16797

    QL > SELECT MAX(SEQUENCE#), THREAD # V$ ARCHIVED_LOG GROUP THREAD #;

    MAX(SEQUENCE#) THREAD #.
    -------------- ----------
    2, 2000
    2060 1

    I did the steps

    Create spfile pfie
    Shutdown
    Started by spifile

    No luck. Journal of applied began. but I see the same error in the datagurd log file

    Here's what it should look like:

    SQL> show parameter pfile
    
    NAME_COL_PLUS_SHOW_PARAM                                                         TYPE
    -------------------------------------------------------------------------------- ------
    VALUE_COL_PLUS_SHOW_PARAM
    ---------------------------------------------------------------------------------------
    spfile                                                                           string
    C:\ORACLE\PRODUCT\11.1.0\DB_1\DATABASE\SPFILEORABASE.ORA
    SQL> 
    

    My guess is that the file is not in the right place. Check the location and your ORACLE_HOME environment variable.

    It should be in $ORACLE_HOME/database for windows, $ORACLE_HOME/dbs for real operating systems.

  • Windows Media Player - how to set the repeat function?

    I set a schedule to play music using Windows Media Player, if I set the repeat function, then it will play the file audio repeatly, but first I would annex plays a sound at a specific time only once without repeat and play another his repeatly at another time, someone has suggestions on how to set this option on the calendar?

    Thanks in advance for your suggestions

    Hello

    What version of Windows Media Player you have installed?

    Try to create individual selections with each audio file. Later, try using the repeat function.

    If you use Windows Media Player 11, you can follow this link.

    Shuffle and repeat items in Windows Media Player


    Reference:
    How to schedule tasks in Windows XP

    Hope the helps of information.

    Please post back and we do know.

  • With the iPad Pro 9.3.1 running, I do find a way to set the sleep function. I sleep in about two minutes. Help

    With the iPad Pro 9.3.1 running, I do find a way to set the sleep function. I sleep in about two minutes. Help

    (It sleeps)

Maybe you are looking for