Which index?

Hi,
I've a view which takes the most rows of a table.
Now i read that if a query takes more than 20% of rows from a table the index don't be used.
This my view:
CREATE OR REPLACE VIEW EULVIS_STROM_STAMM ( INTERNENUMMER,
ANLAGENNUMMER, KUNDENNUMMER, MASTERNUMMER, ANLAGENTYP,
WASSER, ERDGAS, FERNWAERME, ANLAGENSTATUS,
ANLAGENVONDATUM, ANLAGENBISDATUM, ABRECHNUNGSGRUPPE, ANLAGENTITEL,
ANLAGENZUNAME, ANLAGENVORNAME, ANLAGENSTRASSE, ANLAGENHAUSNUMMER,
ANLAGENHAUSNUMMERNERGAENZUNG, ANLAGENPLZ, ANLAGENORT, ANLAGENSTRASSENSCHLUESSEL,
KUNDENTITEL, KUNDENZUNAME, KUNDENVORNAME, KUNDENSTRASSE,
KUNDENHHAUSNUMMER, KUNDENHAUSNUMMERNERGAENZUNG, KUNDENPLZ, KUNDENORT,
AKTUELLETEILZAHLUNG, LETZTEHABENBUCHUNG, DATUMLETZTEHABENBUCHUNG, TAGESSALDO,
DATUMLETZTERECHNUNG, STROMVERBRAUCH, DATUM ) AS SELECT
CAST(GIS_STAMM.INTERNENUMMER AS NUMBER(30, 0)), CAST(GIS_STAMM.ANLAGENNUMMER AS NUMBER(30, 0)), CAST(GIS_STAMM.KUNDENNUMMER AS NUMBER(30, 0)), CAST(GIS_STAMM.MASTERNUMMER AS NUMBER(30, 0)), GIS_STAMM.ANLAGENTYP,
GIS_STAMM.WASSER, GIS_STAMM.ERDGAS, GIS_STAMM.FERNWAERME,
GIS_STAMM.ANLAGENSTATUS, GIS_STAMM.ANLAGENVONDATUM, GIS_STAMM.ANLAGENBISDATUM,
GIS_STAMM.ABRECHNUNGSGRUPPE, GIS_STAMM.ANLAGENTITEL, GIS_STAMM.ANLAGENZUNAME, GIS_STAMM.ANLAGENVORNAME, GIS_STAMM.ANLAGENSTRASSE,
GIS_STAMM.ANLAGENHAUSNUMMER, GIS_STAMM.ANLAGENHAUSNUMMERNERGAENZUNG, GIS_STAMM.ANLAGENPLZ, GIS_STAMM.ANLAGENORT, CAST(GIS_STAMM.ANLAGENSTRASSENSCHLUESSEL AS NUMBER(30, 0)),
GIS_STAMM.KUNDENTITEL, GIS_STAMM.KUNDENZUNAME, GIS_STAMM.KUNDENVORNAME, GIS_STAMM.KUNDENSTRASSE, GIS_STAMM.KUNDENHHAUSNUMMER,
GIS_STAMM.KUNDENHAUSNUMMERNERGAENZUNG, GIS_STAMM.KUNDENPLZ, GIS_STAMM.KUNDENORT, GIS_STAMM.AKTUELLETEILZAHLUNG, GIS_STAMM.LETZTEHABENBUCHUNG,
GIS_STAMM.DATUMLETZTEHABENBUCHUNG, GIS_STAMM.TAGESSALDO, GIS_STAMM.DATUMLETZTERECHNUNG, GIS_STAMM.STROMVERBRAUCH, GIS_STAMM.DATUM
FROM GIS_STAMM
WHERE GIS_STAMM.STROM = 'J'
I've an index of the field STROM and when i analyze a query of my view i see that whole table was used and not the index.
Which index should i use?
Thanks in advance
Nicole

Hello
What will your new table contain? 200000 rows of data, all of which you need to access. Now create an index on that table and...oracle will ignore the index because it will take longer to go to the index to find a row in the table and then go back to the table to get the value than it would to just go through the table from start to finish.
The rationale is, if you are going to be going to every row in the table, you may as well ignore any indexes because they will only slow you down.
If you are looking to access only a few rows in the table, an index can help because it allows oracle to locate the rows you are interested in without having to scan the whole table. But in your case, an index will do nothing other than slow you down
Excuse my ignorace, what is an ACP script? And again, what is the problem with this external program? Is it a program where a user sits and waits for it to complete or is it just a batch type program that does it's work in the background? Other than a view being slow, which really it isn't, you haven't really stated what the problem is you are trying to overcome.
HTH
David

Similar Messages

  • Which index  I should create  Btree or Bitmap  index?

    I have table with columns c1,c2,c3
    I want to create index on column c1
    which index I should create Btree or Bitmap index
    the column contain 50% unique values and 50% duplicate values
    If Btree why?
    If Bitmap Why?
    I know that
    Btree is used when there more unique values (high cardinality)
    Bitmap is used when there less unique values (low cardinality)

    read this -
    Deadlocks with Bitmap Indexes
    Bitmap indexes were designed to be used solely within data warehouses, i.e. where the vast majority of the database activity is reading data,
    and there's very little (or no) data modification, except for batch processes which occasionally re-populate the warehouse.
    Each "row" in the bitmap index contains references to potentially many different rowids, in contrast to a B*-tree index which references a single rowid.
    It should be obvious, therefore, that, since the transactional mechanism is the same for all database operations, that any DML on a table which impacts the bitmap index may end up locking (or attempting to lock) many different "rows" within the index.
    This is the key concept with deadlocks in bitmap indexes, you're not being deadlocked on the underlying table, but on the index blocks. Courtesy - http://www.oratechinfo.co.uk/deadlocks.html
    hope u got it now...

  • How to tell which Indexes are not being used?

    We are a large development shop and have many customers. Our database design is very generic so that it works for all of our customers. Each night we use an SSIS ETL process to bring down large amounts of data from the iSeries into SQL. One
    particularily large customer takes a very long time and we are looking for ways to speed up thier data import and transformation. I would like to see which indexes he does not use and possibly remove them. Each night we fully repopulate hundreds of staging
    and ods tables and incrementally delete and repopulate the days work for a handful of history type tables. Removing some indexes off of the large tables could make a big impact. 
    How can i tell which indexes the customer does not use?

    > IDENTIFYING UNUSED INDEXES IN A SQL SERVER DATABASE 
       Just because an index is not being used does not necessarily mean it should be removed.
    > Index This: All About SQL Server Indexes
    sp_BlitzIndex
    José Diz     Belo Horizonte, MG - Brasil

  • How can i know which index will be used when executing the query ?

    1 ) I have query in which i have 3-4 tables but there multiple index on one column .
    so how can i know which index will be used when executing the query ?
    2) I have a query which ia taking too much time . how can i know which table is taking too much time ?
    3) Please Provide me some document of EXplain plan ?

    Hi Jimmy,
    Consider the below example
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    CREATE TABLE FIRST AS
    SELECT * FROM all_objects;
    UPDATE FIRST
    SET object_name = 'TEST'
    WHERE owner != 'SCOTT';
    CREATE INDEX idx_first ON FIRST(object_name);
    SELECT *
    FROM FIRST
    WHERE object_name = 'TEST';
    It has not used index
    Execution Plan
    Plan hash value: 2265626682
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 58678 | 7334K| 163 (4)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| FIRST | 58678 | 7334K| 163 (4)| 00:00:02 |
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    SELECT *
    FROM FIRST
    WHERE object_name = 'emp';
    This has used the index
    Execution Plan
    Plan hash value: 1184810458
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 128 | 1 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| FIRST | 1 | 128 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IDX_FIRST | 1 | | 1 (0)| 00:00:01 |
    From this we can come to the conclusion that, whether to use one index or not by oracle
    would also depend on the data which is present in the table. This has to be this way as
    we see in the bind peeking, if oracle sticks to only one plan, say only use the full table
    scan, it would be a performance hit when it searches for the second query ie where object_name
    ='emp';
    2.
    If we have a query like below.
    select * from emp
    where upper(ename) = upper(:p_ename);
    Evenif we have the index on ename column, oracle wouldn't be able to use the index, as there is a function in the predicate column. If you need oracle to use the index, we need to create a function based index as below.
    Create index idx_ename on emp(upper(ename));
    Regards,
    Cool

  • Which index will it take and why ?

    Hi, 
    I have a table Employee and i have an index on EmpID on this table. Now i have created a view EmpView on this table. I have created an index on this view for the same column EmpID.
    Now my question is If i query select * from Empview where empId = something then which index will it consider and why?? 
    Thanks in advance
    Balaji 
    Balaji - BI Developer

    Good day Balaji
    Prasad 
    1. How long it took you to write the question in the forum?
    You are asking about specific case in your database. I am sure that you could open click on the Execution Plan button and get a faster answer and much more accurate for your specific database. Not always the forum is the best and faster solution, sometimes
    you can get it yourself.
    Regarding the "why", it is a good question :-)
    please post DDL+DML
    2. As other mentioned if you want help regarding a query then we need to be able to reproduce the situation. Instead of stories on your tables, you could post the DDL+DML queries :-) that mean the create table (with indexes) query and the insert sample
    data query. With this information we can click the Execution Plan button in our server :-)
    Moreover, with DDL+DML we might suggest a better solution
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Which Index is better?

    Hi ,
        Can u let me know which index on fact table is better for query performance. Is it bit map or bit tree? Also , how to change the type of index on the fact table.
    Thanks.

    Hallo Apurva
    The standard BW index are BIT MAP Index. In case you have high cardinality in the dimension than you can flag it in the dimensiona and the sytem create B-tree index.
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a6473e07211d2acb80000e829fbfe/frameset.htm
    Mike

  • TREX Active Index - Which index is really being used?

    We are using ISA E-Commerce 5.0 for ERP 6.0. We run the ISA_CATALOG_REPLICATION program as an hourly job to create indexes in TREX. We add items to our catalog several times a day. Our variant is set to keep 5 indexes.
    1. Where do I verify which index is REALLY active? They are all green in TREX Admin and they all have an Active flag in SRMO. (I am pretty certain the older indexes are not being used by ISA because the new items show up in B2B after the ISA_CATALOG_REPLICATION completes)
    2. When the ISA_CATALOG_REPLICATION cancels due to an SRET error, I want to go back to the last valid index in TREX and force the system to use that index. How do I do that?
    Thank you
    Jon Sells

    SAP told that this functionality is not available in TREX. So there really is no point in having more than 1 index at a time.

  • Which index rebuild?

    Hi,
    i have question about index rebuild
    how can findout which index rebulid?

    Generally speaking, none of your indexes will need rebuilding, so forget all about them and let them do their work without fiddling with them.
    Right: there will always be a few exceptions to such general rules. There are no easy rules to follow, though, despite what some so-called experts will tell you.
    Classically, you are supposed to do analyze index blah validate structure and then query the view INDEX_STATS. If DEL_LF_ROWS divided by LF_ROWS is greater than about 0.25 (that is, 25% of the index is marked as deletable but hasn't been lately), and if that ratio doesn't improve by itself over the course of the next few days, then the index might be considered a candidate for a rebuild.
    Rather less classically, but rather more practicably, if you have metrics for how queries are supposed to perform and you regularly track against those metrics, then when the metric indicates a slow-down, you might at least investigate whether the index has blown out and could do with a bit of re-compaction.
    You might also reasonably rebuild your index if moving it into archive partitions or soon-to-be read-only tablespace, for then you will want the index to be as compact as possible.
    You might also very reasonably drop indexes before a bulk load and therefore equally reasonably re-create them after the load.
    Similarly, if you discover you got the order of columns wrong (because your queries always want to select things by column S and D, but your index is built on columns D, G and S), then you will be looking to drop and re-create the index from scratch.
    But most indexes really don't need routine maintenance.

  • How CSSCAN determines which indexes need to be rebuild ?

    Hi everybody,
    i'm currently migrating 3 Oracle databases that contain CP1252 characters unproperly stored in WE8ISO8859P1 instances.
    The key steps of the migration are :
    1. ALTERing CHARACTERSET to WE8MSWIN1252
    2. changing CHARACTER SEMANTIC LENGTH for CHAR and VARCHAR2 columns
    3. truncating data stored in VARCHAR2(4000) columns
    2. Full export
    3. Full import in a ALL32UTF8 instance
    To do all of this (and especially the step 3), i use the CSSCAN utility (very practical !!!).
    And i have a question about CSSCAN: how CSSCAN determines which indexes need to be rebuild. What is the logic ?
    Looking at the CSSCAN report, i have a lot of cells/columns that are affected by the characterset migration, and i have just a few index to rebuild.
    Why would i like to understand the logic ? Because i would like to rebuild ONLY indexes that REALLY need to be rebuilt and i am not sure that all the indexes specified by CSSCAN really need to be rebuilt.
    Thanks for any information about that.
    (and sorry for my english)
    NB: i have managed "function-based indexes" specifically: i drop them before the export, and i recreate them after the import. So my question mostly target the "regular indexes"

    1. All indexes whose key contains at least one character column with convertible or exceptional data, excluding indexes with names equal to some constraint name for the same owner.
    plus
    2. All functional indexes on tables that have columns needing conversion, excluding indexes with names equal to some constraint name for the same owner.
    The condition regarding constraints does not seem to be very fortunate but it comes from times when the appropriate flag in index metadata was not yet available.
    But note that in your migration scenario, you do not actually have to care much about indexes. Step 1 & 2 do not need any modifications to the user data and hence to index contents. Step 3, if done through UPDATE, will modify affected indexes automatically. Step 4 does not affect the database. Step 5 will recreate all existing indexes anyway.
    -- Sergiusz

  • How can we know which index is triggered

    hi all ,
    how can we know which index is triggered in perticular select statement ? is that just based on the fields which used in the select statement or can we know from ST05 ?
    thanks,
    ram

    Hi Ram,
    You can go to transaction ST04(if you are authorised)...
    Now select 'Detail analysis menu' button.
    Now select SQL Request button under 'Resource consumption by' section.
    Now in the ' SQL statement pattern by ' field , give the part of the select statement you want to check.
    Now press execute.
    Now select the line item displayed and goto menu option <b>Goto->Explain SQL</b>.
    It will give you the execution plan for the particular SQL statement.
    From here you can get the index values from INDEX RANGE SCAN statement in this output.
    Hope this has been of some help to you...
    Regards,
    SP.

  • How to find which queries is using which indexes

    So, I have a db 11gr2 and many indexes. Since I would like to delete some of them, I could see which indexes are unused, but I would like to see if some of indexes are used ony by one or two queries...
    how could I found that?

    If you have license for AWR views, use the below sql to identify indexes used.
    This script has following bind variable
    a1: owner
    a and b: begin and end of snapshot
    a2: tablespace name where your index exists
    As suggested in this thread, do not plan to drop Foriegn key indexes if they are not listed.
    col object_name for a30
    col tablespace_anme fora 12
    col count for 9999
    col operation for a35
    col options for a25
    set lines 160
    select c.*, d.tablespace_name
    from (select
    a.object_name ,
    a.operation ,
    a.options ,
    count(1)
    from
    dba_hist_sql_plan a,
    dba_hist_sqlstat b
    where
    a.object_owner ='&a1'
    and
    a.operation like '%INDEX%'
    and
    a.sql_id = b.sql_id
    and b.snap_id between &a and &b
    group by
    a.object_name,
    a.operation,
    a.options
    order by
    4 desc) c,
    dba_segments d
    where c.object_name=d.segment_name
    and d.tablespace_name='&a2'

  • Which index values can be sent to "Insert Into Array" without changing the present array ? E.g. index -1 ?

    Which index values can be sent to "Insert Into Array" without changing the present array ? E.g. index -1 ?
    Could not find this info via the "Context Help" window.

    If you have to handle situations where you do not want to insert something in an array, then you can either use a negative index value as you suggested, or put the insert node in a case structure, with the "do not insert" case empty (almost...just crossed by the array wire!..)
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Which index file is the one i upload my changes in, the .asp or the .shtml file?

    CAN SOMEONE HELP ME IN UNDERSTANDING WHICH INDEX FILE I SHOULD UPLOAD MY CHANGES IN FOR MY HOME PAGE, THE .ASP OR THE .SHTML FILE?  I HAVE PUT IN MY CHANGES IN BOTH FILES, HOWEVER, WHEN I F12 MY CHANGES IN THE .ASP, I ONLY GET THE OPTION THE SAVE AND THEN OPEN THE FILE, AND NOTHING HAPPENS.   WHEN I F12 MY .SHTML FILE, ALL MY CHANGES WORK WITH THE EXCEPTION OF MY WEBPAGE BACKGROUND WHICH IS ON ALL MY PAGES.  I NEED THE BACKGROUND TO SHOW UP AS IT IS ON THE WEBSITE NOW, WITH MY CHANGES, SO I NEED SOME EXPERT ADVICE TO HELP ME WITH THIS.
    THANKS,
    rod_sha

    Sorry guys, for the all caps question.  I'm new at this and only know some of the simple things to do to update the home page.  I am updating a good friend of mine, Mike Glenn's webpage.  I have posted a image and a video on the index.shtml page that we are trying to let viewers and possible investors see the movie we are trying to do on Mike Glenn.  I used vimeo to upload the video and used the code it supplied for the link to the movie.  Mike's website is www.mikeglenn.com.  Being new at trying to make changes to his home page, I wanted to make sure that the index.shtml file was the right file to use.  Everything on the page works but his background does not show up when I do F12 to look at my changes before I upload them.  I've looked at the code on the website, and the only thing that is different from his web page is the items I'm trying to upload.  That's why I'm puzzled about the background.  Any help on fixing this and understanding why I don't see his background would be greatly appreciated.  I'm needing to get it updated as soon as possible in order for us to get the funding for completing the movie on Mike.  Mike Glenn is a former NBA player that played here in Atlanta for the Atlanta Hawks.  He has a free basketball camp for the Deaf and Hard of Hearing that has been going on now for 33 years.  The movie is about how he started the camp and his love for the Deaf community.  Both the .asp and the .shtml files start with index.  I would like to thank you guys for responding to me. If you need to contact me, I can be reached on my cell at 404-433-0838 or e-mail at [email protected]
    Sincerely,
    Rodney Terrell

  • Which index to use?

    I have a table containing large complete 2D polygons (State and county boundaries). Each row in the table represents an entire polygon rather than a linestring section of a polygon.
    There are a large number of vertices in each polygon - some rows have over 100,000 entries in the SDO_ORDINATE_ARRAY.
    What sort of index should I use to maximise the performance?
    I am currently using Fixed Tile Quadtree indexing with an SDO_LEVEL of 6.
    Would R-Tree or Hybrid indexing suit such a geometry better?

    Hi,
    It depends on which version of Oracle Spatial you are using.
    As of Oracle 9i, the recommendation is to use R-tree indexes (they are easy to
    create, there is no tuning, their performance is nearly always as good or better
    than quadtree indexes, they can be geodetic, there is functionality only supported
    when using R-tree indexes). There are still a few cases where quadtrees have
    better performance, but R-tree indexes are getting better all the time.
    In earlier versions, there are a lot of cases where quadtrees are better suited to do some
    kinds of queries.
    Oracle doesn't recommend using hybrid quadtree indexes.
    If you are having performance problems, you might want to use spatial index advisor
    to help you determine a good indexing level for a quadtree index.

  • Which Index to create on column ?

    Hi Guys,
    I have a table, which has some no. of columns. In that, one column is of Varchar2(1) which contains the value either 'Y' or 'N' and there are two other columns which contains the sequential numbers and these are unique values. So the data is like below.
    Col1     Col2     Col3
    1     1     Y
    1     2     Y
    1     3     N
    1     4     N
    2     5     N
    2     6     Y
    2     7     Y
    2     8     YThese are the three main columns that will be used in all the queries with other tables, and there scenarios also when only col3 will be used in the queries.
    My problem is how do I create index on this table, 1) should I create a Bit map index on Col3 and Btree index on col1 and col2
    or 2) I should create btree index on all the three columns.
    In case of 1, how the index can be used to improve the performance of the query, do we need to give some hint so that both the indexes are used to execute the statement.
    Much appreciate your help.
    Thanks in advance.
    Vinod.

    If this table has frequent concurrent inserts and updates then you should probably stear well clear of a bitmap index.
    Presumably you are constraining the unique values with a primary key which means that you're going to have an index on 1 and 2 anyway.
    With column 3, unless there is a large skew in the distribution of data between Y and N, it's unlikely that an index is going to prove particularly useful.
    With a YN column, as it is a low cardinality column, it can often be a good candidate for being the leading column in a composite index such that queries on columns 2 and 3 in the index can use a skip scan. However given that cols 1 and 2 are already indexed, if there are no other columns in the table, it doesn't sound justifiable.
    But if you have the various queries that will be used against this table, it's a good idea to test the various scenarios and compare performance between the various approaches. But bear in mind that the concurrent activity against bitmaps is key.

Maybe you are looking for

  • Port Replicator?

    Is there a high speed port replicator compatible with the kirabook? Does the "Port Replicator II" (http://us.toshiba.com/accessory/PA3916U-1PRP/) work for that particular model? Thanks. FVB Solved! Go to Solution.

  • How to Include BuildProject in Eclipse

    Hi, Using Eclipse IDE, developing Tomcatproject. When I try to Build the project(by right clicking that Tomcatproject), am not seeing that "BuildPath". Tell me where I'm doing the mistake. Thanks, Hari

  • Drive space usage is greater that sum of folder space

    I just created a new boot disk and then restored files from Time Machine. didn't restore everything, which would have amounted to about 248 GB. But when I look at the information (Get Info) for the drive under Devices is is currently showing that the

  • Don't want personal emails showing in work email inbox (8330 Curve)

    I succesfully set up my personal email account (comcast) on my 8330 Curve, but the messages are showing in both the main inbox (work) and also the comcast inbox.  Does anyone know how to get the device to only show them in the personal inbox? Solved!

  • Posting manual SD conditions to COPA

    Hi, I have customized KE4I transaction with all the SD condition types, but when the billing document has the conditions filled manually it doesn't appear in the PA document. Is it possible to post this conditions to COPA? Thank you very much!!!