Index of the question - do not include the cost

Hello

I have a table of 112mil lines that I copied to a new tablespace, which worked well
I am so adding indexes to the copied table, but gets enormous costs in plans by trying to make a request using the new index, similar to quirying the original table/index

First of all I tired to change my main index to an another initial tablespace more great extension, and even if I remove all cela and put it in the table space as well as the original index and created the same way, I get the same huge difference.

In most om my system this will cause queries that the CBO does not use the index, and applications get very slow. If I do a simple select statement, and the index is selected, even if the cost is enormous, the moment of the actual query is the same as the original table/query. I can't get the cost of the change index by trying different dbms_stats.gather_index_stats settings

Can someone tell me why this new index comes up with such a huge cost, and what I can do to lower the cost, so that the index gets actually chosen?

Here is some basic information:

It's about Oracle 10 g 2 (10.2.0.4) EA

The simplified create statement for the original and the new index:

CREATE INDEX IDX_POS_DATE ON FMC_POS
("UTC_DATE' DESC, FMC_LOGVES_ID)

CREATE the INDEX IDX_POS_DATE_P2 on FMC_POS_p2
("UTC_DATE' DESC, FMC_LOGVES_ID)

The two indices in dba_indexes:

Source language:
OWNER: VTRACK
INDEX_NAME: IDX_POS_DATE
INDEX_TYPE: BASED ON A NORMAL FUNCTION
TABLE_OWNER: VTRACK
TABLE_NAME: FMC_POS
TABLE_TYPE: TABLE
UNIQUENESS: NO SINGLE
COMPRESSION: DISABLED
PREFIX_LENGTH:
NOM_TABLESPACE: USERS
INI_TRANS: 2
MAX_TRANS: 255
INITIAL_EXTENT: 65536
NEXT_EXTENT:
MIN_EXTENTS: 1
MAX_EXTENTS: 2147483645
PCT_INCREASE:
PCT_THRESHOLD:
INCLUDE_COLUMN:
FREELISTS:
FREELIST_GROUPS:
PCT_FREE: 10
LOGGING: YES
BLEVEL: 3
LEAF_BLOCKS: 439239
DISTINCT_KEYS: 108849202
AVG_LEAF_BLOCKS_PER_KEY: 1
AVG_DATA_BLOCKS_PER_KEY: 1
CLUSTERING_FACTOR: 79021005
STATUS: VALID
NUM_ROWS: 110950137
SAMPLE_SIZE: 2177632
LAST_ANALYZED: 05/09/2011 23:38:15
DEGREE: 1
INSTANCES: 1
PARTITIONED: NO.
TEMPORARY: N
GENERATED: N
SCHOOL: N
USER_TABLES: DEFAULT
USER_STATS: NO.
DURATION:
PCT_DIRECT_ACCESS:
ITYP_OWNER:
ITYP_NAME:
PARAMETERS:
GLOBAL_STATS: YES
DOMIDX_STATUS:
DOMIDX_OPSTATUS:
FUNCIDX_STATUS: ENABLED
JOIN_INDEX: NO.
IOT_REDUNDANT_PKEY_ELIM: NO.
ELIMINATED: NO.

New:
OWNER: VTRACK
INDEX_NAME: IDX_POS_DATE_P2
INDEX_TYPE: BASED ON A NORMAL FUNCTION
TABLE_OWNER: VTRACK
TABLE_NAME: FMC_POS_P2
TABLE_TYPE: TABLE
UNIQUENESS: NO SINGLE
COMPRESSION: DISABLED
PREFIX_LENGTH:
NOM_TABLESPACE: USERS
INI_TRANS: 2
MAX_TRANS: 255
INITIAL_EXTENT: 65536
NEXT_EXTENT:
MIN_EXTENTS: 1
MAX_EXTENTS: 2147483645
PCT_INCREASE:
PCT_THRESHOLD:
INCLUDE_COLUMN:
FREELISTS:
FREELIST_GROUPS:
PCT_FREE: 10
LOGGING: YES
BLEVEL: 3
LEAF_BLOCKS: 408128
DISTINCT_KEYS: 111888565
AVG_LEAF_BLOCKS_PER_KEY: 1
AVG_DATA_BLOCKS_PER_KEY: 1
CLUSTERING_FACTOR: 88607794
STATUS: VALID
NUM_ROWS: 112757727
SAMPLE_SIZE: 112757727
LAST_ANALYZED: 23/06/2011 07:57:14
DEGREE: 1
INSTANCES: 1
PARTITIONED: NO.
TEMPORARY: N
GENERATED: N
SCHOOL: N
USER_TABLES: DEFAULT
USER_STATS: NO.
DURATION:
PCT_DIRECT_ACCESS:
ITYP_OWNER:
ITYP_NAME:
PARAMETERS:
GLOBAL_STATS: NO.
DOMIDX_STATUS:
DOMIDX_OPSTATUS:
FUNCIDX_STATUS: ENABLED
JOIN_INDEX: NO.
IOT_REDUNDANT_PKEY_ELIM: NO.
ELIMINATED: NO.

The simple selects and costs:

Original table / index:

Select * from fmc_pos where utc_date > sysdate-10
Plan:
ALL_ROWS SELECT STATEMENT
Cost: 5 bytes: 5,350 cardinality: 50
TABLE ACCESS BY INDEX ROWID VTRACK TABLE 2. FMC_POS
Cost: 5 bytes: 5,350 cardinality: 50
1 INDEX RANGE SCAN INDEX VTRACK. IDX_POS_DATE
Cost: cardinality 4: 1

Original table / index:

Select * from fmc_pos_p2 where utc_date > sysdate-10
Plan:
Plan
ALL_ROWS SELECT STATEMENT
Cost: 3,067 bytes: 2.708.856 cardinality: 25.082
TABLE ACCESS BY INDEX ROWID VTRACK TABLE 2. FMC_POS_P2
Cost: 3,067 bytes: 2.708.856 cardinality: 25.082
1 INDEX RANGE SCAN INDEX VTRACK. IDX_POS_DATE_P2
Cost: cardinality 2.927: 177

>

Original table/index:

select * from fmc_pos where utc_date>sysdate-10
Plan:
SELECT STATEMENT  ALL_ROWS
Cost: 5  Bytes: 5.350  Cardinality: 50
2 TABLE ACCESS BY INDEX ROWID TABLE VTRACK.FMC_POS
Cost: 5  Bytes: 5.350  Cardinality: 50
1 INDEX RANGE SCAN INDEX VTRACK.IDX_POS_DATE
Cost: 4  Cardinality: 1  

Original table/index:

select * from fmc_pos_p2 where utc_date>sysdate-10
Plan:
Plan
SELECT STATEMENT  ALL_ROWS
Cost: 3.067  Bytes: 2.708.856  Cardinality: 25.082
2 TABLE ACCESS BY INDEX ROWID TABLE VTRACK.FMC_POS_P2
Cost: 3.067  Bytes: 2.708.856  Cardinality: 25.082
1 INDEX RANGE SCAN INDEX VTRACK.IDX_POS_DATE_P2
Cost: 2.927  Cardinality: 177

Look at the stats of the table, not the index statistics. Cardinalities are extremely different.
Specifically, what are the high and low values on the utc_date column.
(The old table statistics are probably days or weeks, obsolete).

Concerning
Jonathan Lewis

Tags: Database

Similar Questions

  • The index on the field date

    Please see my table
    create table DATE_TEST
    (
      ID         VARCHAR2(6) not null,
      ID_DESC    VARCHAR2(250),
      START_DATE DATE,
      END_DATE   DATE
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table DATE_TEST
      add constraint DATE_TEST_PK primary key (ID);
    -- Create/Recreate indexes 
    create index DATE_TEST_IDX1 on DATE_TEST (END_DATE));
    create index DATE_TEST_IDX2 on DATE_TEST (START_DATE);
    No I haven't added some data in the table. My problem is that it does not index between the query.

     EXPLAIN PLAN FOR SELECT * FROM       DATE_TEST WHERE           start_date between to_date('01/01/2012','DD/MM/YYYY') AND to_date('31/12/2012','DD/MM/YYYY')           OR  end_date between to_date('01/01/2012','DD/MM/YYYY') AND to_date('31/12/2012','DD/MM/YYYY')
      2  /
    
    Explained
    
    SQL>      SELECT * FROM  TABLE( DBMS_XPLAN.display);
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
    Plan hash value: 4189439861
    -------------------------------------------------------------------------------
    | Id  | Operation         | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    -------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |           |   954 |   139K|     7   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| DATE_TEST |   954 |   139K|     7   (0)| 00:00:01 |
    -------------------------------------------------------------------------------
    Predicate Information (identified by operation id):
    ---------------------------------------------------
       1 - filter("START_DATE">=TO_DATE(' 2012-01-01 00:00:00',
                  'syyyy-mm-dd hh24:mi:ss') AND "START_DATE"<=TO_DATE(' 2012-12-31
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss') OR "END_DATE">=TO_DATE('
                  2012-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "END_DATE"<=TO_DATE(' 2012-12-31 00:00:00', 'syyyy-mm-dd hh24:mi:s
    Note
    -----
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
       - dynamic sampling used for this statement (level=2)
    
    21 rows selected
    Why it does not index and what are the other solutions for this

    Your query does not take the index because the cost of FTS is lower than that of the index analysis...

    You could put a TIP if you want to force the use of the index - which is NOT ADVISED.

  • BACKUP QUESTION: Why is it when I backup the Lightroom Catalog (Edit |) Settings of catalog...) only the *.lrcat file included in the ZIP file... While the *., lrdata file, the preview files, ARE NOT INCLUDED?  When I restore the file *.lrcat from a backu

    BACKUP QUESTION: why is it that when I backup the Lightroom Catalog (Edit |) Settings of catalog...) only the *.lrcat file included in the ZIP file... While the *., lrdata file, the preview files, ARE NOT INCLUDED?  When I restore the *.lrcat file from a backup, WHERE ARE THE PREVIEW FILES that should be included in the ZIP to the top.  If *.lrdata (Preview file) are so important, why are not included in the zip?  [email protected]

    CraigLevine wrote:

    OK, so that's my scenario:

    • QUESTION: WHEN I USE THE [Sub-master] .lrcat, on the new computer, don't need to inculde also files .lrdata [Sub-master] on this external drive?
    • If .lrdata [Sub-master] is regenerated automatically, where he gets all the work (from the preview files) that I did, when I was working, using the .lrdata [Sub-master] when he was on the local disk.

    Thanks again for staying with me on this.  I don't know that your answer will solve my confusion. -Craig

    [email protected]

    Questions 1)

    Not because the LRDATA file is fair previews, what LR displays on your screen for a faster loading of the image and will be recreated. The previews only stored in the folder LRDATA is the basic overview created at time of importation for the display of thumbnails and previews of 1:1 for images that you have actually looked in the Loupe View or I guess that appears in the develop module.

    He get all the data to create the image themselves file extracts.

    If you have several files on your system that have pictures in them and you select one of them that you have not looked at in a while, you will notice LR creation of previews for these images, there will be 3 white dots in the upper right corner of the thumbnail. It's LR creation of previews for the thumbnail view. If you scroll quickly in the grid view, you'll notice a few thumbnails of images are gray, until you stop scrolling, then the upper left tile will come in clear view and the white dots will appear on the other images. It's LR creating previews for those of other images. Once LR created the preview of thumbnails that are on your screen, white spot will disappear. If you scroll down again, you will see more white dots

    If you switch to another folder that LR begins again create preview images in this folder. The total number of previews created and stored based on caching of the preview you have in the catalog settings dialog in the management of the files tab.

    If not, you need not the LR Previews.lrdata folder. Whenever LR is not very good this folder with a catalog he recreates it to store previews in.

  • SnippingTool does not include the URL when I drag an html screenshot in IE8

     

    Hello everyone

    Despite the fact that I had ticked the optioninclude URL below shears (HTML only) ".

    The cutting tool does not include the URL when I drag and drop a screenshot of Iexplore 8 html

    I have Windows Vista SP2 with IE8 and I must maintain this version...

    Any suggestions will be appreciated

    Hi Jose,

    Scan the file system (CFS) auditor to repair corrupted files.

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7
    http://support.Microsoft.com/kb/929833

    You can also view Snipping Tool: frequently asked questions

  • Does not include the network folder in the document library

    I'm a network administrator.  I created a %username\documents for all users folder and apply the necessary security.  For most users, I make this folder available offline, and I'm able to include in their document library.

    For the last two users I did this, but failed to include the folder in the Documents, the error that it is not indexed.  On the server, the drive and the subfolders are all able to be indexed in the settings.  The file is properly sync to the computer.  But I still get the error that the file is not indexed.
    I have disabled the sync on the computer, has added the formatdatabase reg key to restart the computer, turned on files offline, set the folder resynchronization, complete synchronization, still cannot add to the document library.
    Then, in case there was a kind of corruption of the files on the server, I deleted the network folder, disabled the files offline on your PC, erased the cache of offline files, created a new documents folder on the server with the correct permissions, activated files offline, synchronize the empty file to the PC and tried to add the new folder of network document to the document library on the PC.  Failed because the empty folder is not indexed.  Once again.
    Any ideas?

    The fixed.

    I needed to turn on the Windows search function to make it work.  You can synchronize files without it, but needs apparently indexing Windows Search to work.  Which is weird, because the Windows Search service can be disabled and it still works.
    I rode on a group policy to disable windows search service because people are complaining about their PC slows down during the reindex operation.  This did not affect the ability to synchronize the network drives or to include them in the libraries.
    On both machines on which I had the problem Windows search had been uninstalled programs and features (which is not really uninstall it, only it hides in Windows features.)
    Conclusion: OK to disable windows search service, do not uninstall or disable the function.
  • Indexing of the options does not not - Dll common shell Windows does not

    Hello

    I can't open the indexing options. It stucks at "awaiting to receive the status of indexing. the error is "Windows Shell common Dll is not responding.
    I tried the fix (support.microsoft.com/mats/windows_search/). And create a new account. And SFC. But nothing does work.
    You have a solution?
    Thank you.

    Hi ATMT

    Thanks for posting in the Microsoft Community.

    I understand that you are facing the issue with indexing options does not and the Windows Shell common Dll message error message does not.

    Method 1:

    I suggest you run the fixit tool and check.

    Difficulty of Windows Desktop Search when it hangs or no display of results

    http://support.Microsoft.com/mats/windows_search/en-us

    Method 2:

    I suggest you perform the clean boot and check.

    Place the computer in a clean boot state, then check if it helps. You can start Windows by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: When you are finished troubleshooting, follow step 3 in the article to start on normal startup.

    Method 3:

    I also suggest you to see the links and check.

    You can also check the below mentioned links.

    http://Windows.Microsoft.com/en-us/Windows7/open-the-search-and-indexing-Troubleshooter

    Change advanced indexing options

    http://Windows.Microsoft.com/en-us/Windows7/change-advanced-indexing-options

    Improve Windows searches using the index: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/improve-Windows-searches-using-the-index-frequently-asked-questions

  • Why a method to create a constraint would allow the index to be used, but not another.

    Hi all

    With the help of:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    SQL Developer Version 4.0.2.15

    I had to do the following query on a table.

    Select distinct chdrnum, tranno

    of ractpf_pgr;

    I ran the setup of SQL in SQL Developer, who told me that he was doing a full table scan,

    (It's what you get using SEPARATE!)

    After some research, I discovered that if I put in question on columns not null check constraints

    and then recreated the index based on these columns, I'd get a full index scan instead of a table scan.

    Good news - off, I went and tried using the following method (I think it's call a constraint of out-of-line)

    and created one for each colmn using snytax below.

    ALTER table RACTPF_PGR add constraint CS_CHDRNUM_NN check (CHDRNUM is not null) validate;

    Ran my SQL Tuning Advisor again - no joy - a full table scan that was happening.

    Did some more research and recreated the constraints with the help of an online method

    ALTER TABLE RACTPF_PGR CHANGE (CHDRNUM CONSTRAINT CS_CHDRNUM_NN NOT NULL);

    My SQL Tuning Advisor is represented - and yes the index was used.


    But what I want to know why a method would cause the index to use another does not


    Thanks in advance.


    The second is a NOT NULL constraint.

    The a ('is not null') is technically not a NOT NULL constraint.

    Give me a moment to start my database, and I will demonstrate.

    Edit: Here's the demo:

    SQL> create table x (a number null, b number null);                  
    
    Table created.                                                       
    
    SQL> alter table x add constraint a_nn check(a is not null) validate;
    
    Table altered.                                                       
    
    SQL> alter table x modify (b constraint b_nn not null);              
    
    Table altered.                                                       
    
    SQL> select column_name, nullable
      2  from user_tab_cols
      3  where table_name = 'X';                                         
    
    COLUMN_NAME
    ----------------------------------------------------------------------
    
    N
    -
    B
    N                                                                    
    
    A
    Y                                                                    
    

    The index does not store registrations for the lines where all components of the index are null, then the optimizer needs to see that the columns are not nullable to be able to use an index scan.

  • timestamp get only date, time is not included in the selection...

    Hi all

    I have a question like that, here (defect_status) is a table with two columns of timestamp (start_date and end_date) including the date and time.

    I selection of data in the table and return data as refcursor. When I'm extraction of cursor and printing data for the test, I get only part of date, part of an hour is not included when printing the data.

    ex:

    Ref_cursor OPEN TO select start_date, end_date defect_status;

    Here start_date, end_date are the timestamps. but, I get only the date. part of the time not included.
    Note: the statement select is written in dynamic sql.

    can someone help me please. How can I get date with time.

    Hello

    What of it?

    Ref_cursor OPEN FOR select to_char (start_date,' dd/mm/yyyy hh), to_char (end_date,' dd/mm/yyyy hh) of defect_status;

    Published by: Divya on October 12, 2010 12:25 AM

  • The podcast is not included in the iTunes Store podcast directory. An error occurred while trying to play an episode of the podcast

    I submitted my podcast feed to iTunes Connect three times. It shows the same error: the podcast is not included in the iTunes Store podcast directory. An error occurred trying to play an episode of the podcast.

    I can't find anything wrong with my workflow. It is validated. I subscribed it to iTunes as Apple suggested in the email. It works as well in iTunes.

    Some argue, there should be at least three ready episode in animal feed. I only have three. What is the problem? Can someone help me? Thank you!

    It comes to my diet:

    http://aizhe.FM/feed/episodes

    I checked the power supply in Podcasts connect and validated it and says "ready for submission. It validates in CastFeedValidator;

    However when you subscribe to iTunes the main episodes in animal feed, E000 (i.e. only Apple controls) downloaded only to half way and then stopped - although on the subscription again, it worked OK. These strange kinds of glitches happen sometimes, and maybe that's what caused the problem. I should try to submit it again and see what happens. (You do not have to have three episodes in the power - one is enough).

  • Attachments in the original message are not included when I send the message

    While transmitting a message with attachments, the attachment is not included in the message.

    This is common with mail generated in Microsoft Outlook. Outlook does not encode attachments properly so they do not move. Use forward as attachment for the mail instead of to the front to include attachments.

  • Mozilla, your last update does not include the last cert of intermediaries of extended validation from Verisign, Symantec class 3 EV SSL CA - G2, please fix ASAP

    Your last update of firefox, Mozilla does not include the last cert of intermediaries of extended validation from Verisign, Symantec class 3 EV SSL CA - G2, please fix ASAP

    Firefox never includes the intermediate certificates.
    It is the responsibility of a server to include all the intermediate certificate required to make it possible to build a certificate chain that ends with a trusted root certificate embedded.

    Note that Firefox automatically records the intermediate certificates that servers send in certificates for future use Manager (they appear labelled as 'Software security device' in the References tab).
    If a server does not send a complete certificate chain then you get an untrusted error when Firefox has stored missing intermediate certificates to visit a server in the past that a send it, but you get an untrusted error if this intermediate certificate is not yet registered.

  • 'reply to all' does not include the sender of email - why?

    I am on Messenger 9.2

    When I hit "reply all" on an e-mail message, the sender of the email is not included.  Why?  (sometimes he doesn't, but mostly).  I have to type additional e-mail separately.  You probably received a lot of emails from the scam of the Republic of Benin or Nigeria, like me.  I send scathing responses.  But the author is not included, unless it is manually entered.

    Thanks for your thoughts.

    Cannot confirm.  It must be something specific to the sender.

  • Why favorites are not included as in the Finder, when I try to open and send a file with safari?

    Why favorites are not included as in the Finder, when I try to open and send a file with safari?

    Here is safari (cmd + O)

    and that's with the Finder:

    before macOSX 10.11.4 it was exactly the sames windows...

    How can I change on Safari and Chrome?

    Thank you very much and excuse me if my English is not very good.

    If you go to Finder > Preferences > sidebar , you will see there is no option for Safari > bookmarks, but you can send a link from Safari.

    In your Safari menu bar, click file > share > Email.

    For Chrome, you may need to use a Goole Chrome for sharing.

  • Nightshift is NOT included in my old version 9.3 of iPads news. What the *?

    Nightshift is NOT included in new 9.3 update my old iPad. What the *?

    Only the most recent devices have the ability for the night shift. Just like older devices may never have Siri or Live Photos, they simply do not have the material for the software work.

  • display the index in the notes not available

    display the index in the notes not available

    explain

Maybe you are looking for