Multiple indexes on a table with various combinations

Hi Experts,
This post is similar to my previous one on indexing. am just trying to understand proper indexing strategy.
Assuming that i have to use following queries frequently.
select Col1, Col2, Col3 from tab where col4='some value'
select Col1, Col2, Col3 from tab where col5='some value'
select Col1, Col2, Col3 from tab where col6='some value'
select Col1, Col2, Col3 from tab where col7='some value'
select Col1, Col2, Col3 from tab where col8='some value'
select Col1, Col2, Col3 from tab where col9='some value'
select Col1, Col2, Col3 from tab where col10='some value'
here, my doubt is, do we need to create "1 clustered + 6 NC covering" indexes (total 7) as we have 7 different columns in the where clause in 7 different select statements? Or, is there any better way of doing this?
Thanks,
Shiva

>am just trying to understand proper indexing strategy.
There is no such a thing. It is an art.
Generally you can use covering index for a business critical query. But that may slow down other queries because the covering index usually wide! You need to
check the execution plans for each query involved.
It is better to apply narrow fast indexes that way other queries will not slow.
Remember STATISTICS! It should be updated nightly:
http://www.sqlusa.com/articles/query-optimization/
The database engine uses the STATISTICS for the execution plan preparation not the index.
For best performance the indexes should be narrow (fast) and STATISTICS up-to-date.
Missing/fragmented/wide indexes & out-of-date STATISTICS are detrimental for performance.
Kalman Toth Database & OLAP Architect
SELECT Video Tutorials 4 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • Spatial index creation for table with more than one geometry columns?

    I have table with more than one geometry columns.
    I'v added in user_sdo_geom_metadata table record for every column in the table.
    When I try to create spatial indexes over geometry columns in the table - i get error message:
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 8
    ORA-06512: at line 1
    What is the the solution?

    I'v got errors in my user_sdo_geom_metadata.
    The problem does not exists!

  • How much time it take to rebuild an index for a table with 20 millions rows

    Hi all,
    i need to rebuild the index of a table containing 20 000 000 row (i don't know why the other people working on this didn't think of rebuilding the index regularly, because i asked and apparently it has never been done :cry: :cry:) i am not a sql developper nor a DBA so i can't mesure how long it take to rebuild the index, does any one have an idea (aproximativly of course :aie:), the other question is there any formula to use in order to calculate how often to rebuild the indexes (i can for example retieve how much rows are delated or inserted daily ...)
    Thanks again
    Taha

    taha wrote:
    :aie: that's why i am asking because i don't know (and to be sure which solution is best)
    so the table is like this (the columns) :
    45 varchar2, 5 timestamp, 30 Number no LOB columns, (15 indexes : 5 unique indexes and that those indexes uses at a maximum 4 columns)15 indexes - 100,000 deletes: this could mean 1,500,000 block visits to maintain index leaf blocks as the table rows are deleted. If you're unlucky this could turn into 1,500,000 physical block read requests; if you're lucky, or the system is well engineered this could be virtually no physical I/O. The difference in time could be huge. At any rate it is likely to be 1,500,000 redo entries at 250 - 300 bytes per entry for a total of about 400MB of redo (so how large are your redo logs and how many log switches are you going to cause).
    yes the tables is used by an application so (update, insert ) can take place at any time
    for the deletion , there is the batch which does a mass delete on the table ( 4 or 5 time each day)
    You haven't answered the question - how long does it take to do a sample batch delete.
    If you can enable SQL tracing, or take a before/after snapshot of v$sesstat or v$session_event for the session as it does the delete then you can get some idea of where the time is going - for all you know it might be spending most of its time waiting for a lock to do away.
    >
    "How many leaf blocks are currently allocated to the index(es) ?" how can i answer to this question ? may be if i check the all_objects table ?
    If you keep your statistics up to date then dba_indexes is a good place, cross-checked with dba_segments, and you can use the dbms_space package for more detail. I have a code sample on my blog which allows you to compare the current size of your indexes with the size they would be if rebuilt at some specific percentage: http://jonathanlewis.wordpress.com/index-sizing/ (It's such good code that Oracle Corp. has copied it into MOS note 989186.1)
    Regards
    Jonathan Lewis

  • Frequent index synchronization for table with a lot of data

    Hello! I have a table with text column to be indexed. There are a lot of records in the table and the texts in the text column are ofter big enough. The number of records are rising frequently and i need actual search results in any time, so i cant synchronize index 1 or 2 times per day, i need to do it after every insert and i also need to base table not to be locked in anytime i synchronizing index.
    So i read the documentation and find a way for me like that:
    after every insert on base table do:
    ctx_ddl.sync_index('my_index')
    And seems like i need to make ctx_ddl.optimize_index() after synchronization.
    So will it work fine or i should go another way?
    Resuming main goals:
    1) I need no locks on base table (or locks on VERY small time);
    2) Always actual search results.

    You can use sync(on commit) in your index parameters, which will make recent DML searchable immediately. You will still need to optimize and rebuild periodically to eliminate index fragmentation. The more frequently that you synchronize, the more fragmented your index will become. Index fragmentation slows down your queries that use the index. If you have some downtime or slow times such as weekends or nights, then that is a good time to do such things. If not, then you may wish to do so "online" to avoid interfering with searches or DML. Depending on the size of your table and the amount of DML, you may choose to optimize and/or rebuild hourly or daily or weekly or monthly or whatever.

  • SQL Server 2014 Bug - with Clustered Index On Temp Table with Identity Column

    Hi,
    Here's a stored procedure.  (It could be shorter, but this will show the problem.)
              CREATE PROCEDURE dbo.SGTEST_TBD_20141030 AS
              IF OBJECT_ID('TempDB..#Temp') IS NOT NULL
                 DROP TABLE #Temp
              CREATE TABLE #Temp
               Col1        INT NULL
              ,Col2        INT IDENTITY NOT NULL
              ,Col3        INT NOT NULL
              CREATE CLUSTERED INDEX ix_cl ON #Temp(Col2)
              SET IDENTITY_INSERT #Temp ON;
              RAISERROR('Preparing to INSERT INTO #Temp...',0,1) WITH NOWAIT;
              INSERT INTO #Temp (Col1, Col2, Col3)
              SELECT 1,2,3
              RAISERROR('Insert Success!!!',0,1) WITH NOWAIT;
              SET IDENTITY_INSERT #Temp OFF;
    In SQL Server 2014, If I execute this (EXEC dbo.SGTEST_TBD_20141030)   It works.   If I execute it a second time - It fails hard with: 
            Msg 0, Level 11, State 0, Line 0
            A severe error occurred on the current command.  The results, if any, should be discarded.
            Msg 0, Level 20, State 0, Line 0
            A severe error occurred on the current command.  The results, if any, should be discarded.
    In SQL Server 2012, I can execute it over and over, with no problem.  I've discovered two work-a-rounds:   
    1) Add "WITH RECOMPILE" to the SP CREATE/ALTER statement, or 
    2) Declare the cluster index in the TABLE CREATE statement, e.g. ",UNIQUE CLUSTERED (COL2)" 
    This second option only works though, if the column is unique.    I've opted for the "WITH RECOMPILE" for now.  But, thought I should share.

    Hi,
    I did not get any error Message:
             CREATE TABLE #Temp
               Col1        INT NULL
              ,Col2        INT IDENTITY NOT NULL
              ,Col3        INT NOT NULL
              CREATE CLUSTERED INDEX ix_cl ON #Temp(Col2)
              SET IDENTITY_INSERT #Temp ON;
              RAISERROR('Preparing to INSERT INTO #Temp...',0,1) WITH NOWAIT;
              INSERT INTO #Temp (Col1, Col2, Col3)
              SELECT 1,2,3
              RAISERROR('Insert Success!!!',0,1) WITH NOWAIT;
              SET IDENTITY_INSERT #Temp OFF;
    SELECT * FROM #Temp
    OUTPUT:
    Col1 Col2
    Col3
    1 2 3
    1 2 3
    1 2 3
    Select @@version
    --Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64) 
    Oct 19 2012 13:38:57 
    Copyright (c) Microsoft Corporation
    Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
    Thanks Shiven:) If Answer is Helpful, Please Vote

  • Error dialog when open index dialog on tables with spatial index

    Hi all,
    When I want to open in the preferences of a table with a spatial index the index dialog, then there appears the following message:
    "Index <myIndex> column GEOMETRY, datatype SDO_GEOMETRY is not a valid column type for use in a text index".
    I can only click the ok button, but I am not able to modify any of my set index.
    Does anyone else have the same problem?
    regards markus
    Version:
    Java: 1.6.0.16
    Oracle IDE: 2.1.1.64.39
    OS: Linux, Ubuntu 9.10
    Edited by: markusin on Mar 3, 2010 12:32 AM

    I have the same problem on SQLDev 2.1.1 for Windows. I hadn't this problem in 1.5.
    I must use a normal sql script to create spatial index.
    Vittorio

  • Index on Partitioned Table with Some ReadOnly Tablespaces

    We have a warehouse with fact tables range partitioned on date - daily partitions with each month worth of partitions put into a specific monthly tablespace. Each month, we set the prior month's tablespace to READONLY. So our table ends up having data in readonly and read-write tablespaces.
    We now have a change we need to make to one of the fact tables - we need to add a new column AND add an index to that column. But because we have partitions in readonly state, Oracle doesn't let us create the index and it also doesn't let us update the local unique key (unique index).
    Is there a way we can do this without having to put the tablespaces in read-write mode? As importantly, what happens when we offline or drop some of the older tablespaces (for archiving purposes)? We need to find a way to add the index on just the read-write partitions.
    Thanks.

    We have a warehouse with fact tables range
    partitioned on date - daily partitions with each
    month worth of partitions put into a specific monthly
    tablespace. Each month, we set the prior month's
    tablespace to READONLY. So our table ends up having
    data in readonly and read-write tablespaces.
    We now have a change we need to make to one of the
    fact tables - we need to add a new column AND add an
    index to that column. But because we have partitions
    in readonly state, Oracle doesn't let us create the
    index and it also doesn't let us update the local
    unique key (unique index).
    Is there a way we can do this without having to put
    the tablespaces in read-write mode? As importantly,
    what happens when we offline or drop some of the
    older tablespaces (for archiving purposes)? We need
    to find a way to add the index on just the read-write
    partitions.
    Thanks.Hi,
    Improvements in Oracle 10g to maintain local-partitioned indexes when you use partition DDL commands:
    add partition, split partition, merge partiton, move partition.
    ALSO, the associated indexes NO LONGER have to be stored on the same tablespace as the table (i.e. answer to your question).
    On Oracle 9i: Local indexes are recommended on data warehouse platforms. In an OLTP system, global indexes are more common. On a data data warehouse, problems can be isoloted to one partition, the partitions moved, made r/o (like yours), no local indexes need to be rebuilt
    Regarding your issue:
    We now have a change we need to make to one of the
    fact tables - we need to add a new column AND add an
    index to that columnTo maintain the simplicity + functionality of your DW configuration, I think you need to change the TS to R/W, update the objects, then alter to R/O.
    fyi
    http://www.oracle.com/technology/deploy/availability/htdocs/online_ops.html

  • Issues with using XMLType indexes against a table with XMLType column

    I am attempting to use an XMLIndex with a Structured Component and not having too much luck. Not much data in metalink nor is the documentation very helpful:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb_indexing.htm#BCGHGIGC
    The table DDL is as follows:
    CREATE TABLE ECI_SCHEMA.REV_ITEM_EARN_DTL_VIRTUAL(
    REV_ITEM_EARN_DTL_ID_NBR NUMBER(16,0) NOT NULL,
    UNIQ_MSG_ID_NBR VARCHAR2(50) NOT NULL,
    REV_ITEM_BILL_DTL_ID_NBR NUMBER(16,0),
    PLAN_RACN_NBR NUMBER(10,0) NOT NULL,
    INV_DTL_IMG SYS.XMLType NOT NULL,
    NON_INV_DTL_IMG BLOB NOT NULL,
    PART_KEY_CD GENERATED ALWAYS AS (MOD(PLAN_RACN_NBR,5)) VIRTUAL,
    LAST_UPDT_TMSTP TIMESTAMP(6) NOT NULL,
    INV_ID_NBR NUMBER(16,0),
    ITEM_STATUS_CD VARCHAR2(1) DEFAULT 'A' NOT NULL
    LOB (NON_INV_DTL_IMG) STORE AS NON_IDI_LOB (CHUNK 8192 PCTVERSION 10 CACHE)
    TABLESPACE ECI_DATA
    PARTITION BY RANGE (PART_KEY_CD)
    PARTITION RIED_DAY0_PART
    VALUES LESS THAN (1)
    TABLESPACE ECI_DATA
    PARTITION RIED_DAY1_PART
    VALUES LESS THAN (2)
    TABLESPACE ECI_DATA
    PARTITION RIED_DAY2_PART
    VALUES LESS THAN (3)
    TABLESPACE ECI_DATA
    PARTITION RIED_DAY3_PART
    VALUES LESS THAN (4)
    TABLESPACE ECI_DATA
    PARTITION RIED_MAXVAL_PART
    VALUES LESS THAN (MAXVALUE)
    TABLESPACE ECI_DATA
    XMLTYPE COLUMN "INV_DTL_IMG" STORE AS OBJECT RELATIONAL
    XMLSCHEMA "someXdbDocument.xsd"
    ELEMENT "revenueInvoice"
    According to the documentation, I should be able to create a structured XMLIndex on the XMLType column with the following syntax:
    SQL> create index eci_schema.rev_item_earn_dtl_virt_xmlix on eci_schema.rev_item_earn_dtl_virtual
    2 (INV_DTL_IMG)
    3 INDEXTYPE IS XDB.XMLIndex
    4 parameters ('PATH TABLE RIED_PATH_TABLE')
    5 local;
    When I do this, I get the following error:
    create index eci_schema.rev_item_earn_dtl_virt_xmlix on eci_schema.rev_item_earn_dtl_virtual
    ERROR at line 1:
    ORA-29958: fatal error occurred in the execution of ODCIINDEXCREATE routine
    ORA-30959: The indexed column is not stored in CLOB.
    What am I doing wrong? Based on the Oracle documentation, I was under the impression that 11.2 XMLIndex would work with Object Relational storage. Is this not the case?

    CREATE INDEX ECI_SCHEMA.REV_ITEM_EARN_DTL_IX7
           ON ECI_SCHEMA.REV_ITEM_EARN_DTL
                      extractValue(inv_dtl_img, '/revenueInvoice/service/transportation/mstrTrkngNbr')
    TABLESPACE ECI_REV_ITEM_EARN_DTL_IX7_ITS
    LOGGING
    PARALLEL(DEGREE 8 INSTANCES 1)
    LOCAL
    /Elements that occur at most once in each document can be indexed using extractValue(). Despite the fact that the index appears to be a functional index, when we create the index we automatically re-write the create index into a normal btree index on the column that contains the value for the element identified by the xpath.
    Eg in the case of a functional index based on extractValue, defined on XMLType using Object relational storage, with an xpath that identifies a node that occurs at most once in each document is not a functional index, it's re-written into a plain old vanilla btree index. You can actually check this by looking in the system tables
    Eg
    SQL> connect system/oracle
    Connected.
    SQL> select table_name, index_name from all_indexes where owner = 'OE' and table_name = 'PURCHASEORDER';
    TABLE_NAME                     INDEX_NAME
    PURCHASEORDER                  LINEITEM_TABLE_MEMBERS
    PURCHASEORDER                  ACTION_TABLE_MEMBERS
    PURCHASEORDER                  SYS_C0011037
    SQL> alter session set current_schema = OE
      2  /
    Session altered.
    SQL> create unique index PO_REF_INDEX on PURCHASEORDER (extractValue(object_value,'/PurchaseOrder/Reference'));
    Index created.
    SQL> set lines 250
    SQL> select index_name, index_type from all_indexes where owner = 'OE' and table_name = 'PURCHASEORDER';
    INDEX_NAME                     INDEX_TYPE
    PO_REF_INDEX                   NORMAL
    LINEITEM_TABLE_MEMBERS         NORMAL
    ACTION_TABLE_MEMBERS           NORMAL
    SYS_C0011037                   NORMAL
    SQL> select * from dba_ind_expressions where table_name = 'PURCHASEORDER' and index_owner = 'OE'
      2  /
    no rows selectedFrom the above we can see that the index created on extractValue has been re-written in a plain old vanilla BTREE index, and there is no definition for it in dba_ind_expressions So assuming you were able to create the index and insert the data you should find that your index is not a functional index.
    ]

  • Spatial index on table with object-column (and inheritance)

    Hi!
    Is it possible to create a spatial index on a table with an object-column (and inheritance) like this:
    CREATE OR REPLACE TYPE feature_type AS OBJECT (
    shape MDSYS.SDO_GEOMETRY
    ) NOT FINAL;
    CREATE OR REPLACE TYPE building_type UNDER feature_type (
    name VARCHAR2(50)
    CREATE TABLE features ( no NUMBER PRIMARY KEY, feature feature_type);
    [...] user_sdo_geom_metadata [...]
    Then
    CREATE INDEX features_idx ON features(feature.shape) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    throws:
    ORA-01418: specified index does not exist
    Curious! :)
    If I define feature_type with "NOT FINAL" option but without subtypes, I get (create index):
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01460: unimplemented or unreasonable conversion requested
    So I think besides object tables also inheritance isn't supported whith oracle spatial!?
    Thanks,
    Michael
    ps:
    We use Oracle9i Enterprise Edition Release 9.0.1.4.0 / Linux.
    Solves Oracle9i 9.2 this problems?

    Hi
    You'll need to be on 9.2 to do this....
    Dom

  • Editable table with multiple rows

    Hi All!
    We're trying to develop some application in VC 7.0. That application should read data from some R/3 tables (via standard and custom functional modules), then display data to user and allow him/her to modify it (or add some data into table rows), and then save it back to R/3.
    What is the best way to do that?
    There's no problem with displaying data.
    But when I try to add something to table (on portal interface), I'm able to use only first row of the table... Even if I fill all fields of that row, I'm not able to add data to second row, etc.
    Second question. Is it possible to display in one table contents of output of several BAPIs? For example we have three bapis, one displaying user, second displays that user's subordinates, and the third one - that user's manager. And we want one resulting table...
    And last. What is the best way to submit data from table view in VC (portal) to R/3 table? I understand that we should write some functional module, that puts data to R/3. I'm asking about what should be done in VC itself. Some button, or action...
    Any help will be appreciated and rewarded :o)
    Regards,
    DK

    Here are some former postings:
    Editable table with multiple rows
    and
    Editable table with multiple rows
    Are you on the right SP-level?
    Can you also split up your posting: one question, one posting? This way you get faster answers, as people might just browse the headers.

  • Inserting Multiple Rows in a table

    Hello,
    I need to insert multiple rows in a table with the selected items from a list (Multiple select).
    How do i go about it. I'm using ADF-struts-UIX application on Jdeveloper 9.0.5.2
    Thanks.

    Jonas, I've downloaded the sample application from your ADF UIX Editable table tip but have some problems.
    I can't even open the emp.table.uix file - errors are:
    Parsing error. Unable to parse binding.
    javax.servlet.jst.el.ELException:Function ctrl:createSortableHeaderModel was not found.
    and
    javax.servlet.jst.el.ELException:Function ctrl:getSortOrder was not found.
    Also - is there a place in the sample where you define the sample tables? They do not seem to match the standard sample emp table, for instance.
    I've just started using JDeveloper and would like to use the solution.
    Thanks - Linda

  • Cannot create text index in partition table on Oracle 10g

    I try to create context index in a table with 15 millions records. The table is divided 5 partitions and each patition has 3 millions records. When I create the context index in the table, the same error always arised. The follow are my work:
    --First create my own lexer
    begin
    ctx_ddl.createperference('my_chinese_lexer','chinese_lexer');
    end;
    --Second create index
    create index idx_part_text3 on tb_test_part(text3)
    indextype is ctxsys.context local (
    partition p1_ix,
    partition p2_ix,
    partition p3_ix ,
    partition p4_ix,
    partition p5_ix)
    parameters('lexer my_chinese_lexer') parallel;
    --error message
    create index idx_part_text3 on tb_test_part(text3)
    Error in 1 line:
    ORA-12801: Parellel Query Server P000 send error signal
    ORA-29855: Error on execute ODCIINDEXCREATE program
    ORA-06510: PL/SQL: User Defined Error
    ORA-06512: In "CTXSYS.DRIDISP", line 244
    ORA-04030: Try to alloc 65548 Bytes (CTX PRM heap,draccbx:message buffer) Out of memory
    ORA-06512: In "CTXSYS.DRIPARX", line 10
    ORA-06512: In "CTXSYS.TEXTINDEXMETHODS", line 359
    ORA-04030: Try to alloc 65548 Bytes (CTX PRM heap,draccbx:message buffer) Out of memory
    ORA-06512: In "CTXSYS.DRUE", line 191
    ORA-06512: In "CTXSYS.DRUE", line 49
    ORA-06512: In "CTXSYS.DRUE", line 24
    ORA-06512: In "CTXSYS.DRUE", line 186
    ORA-06512: In "CTXSYS.DRVDDL", line 682
    ORA-04030: Try to alloc 65548 Bytes (CTX PRM heap,draccbx:message buffer) Out of memory
    ORA-04030: Try to alloc 65548 Bytes (CTX PRM heap,draccbx:message buffer) Out of memory
    ORA-06512: In "CTXSYS.DRUE", line 191
    ORA-06512: In "CTXSYS.DRUE", line 49
    ORA-06512: In "CTXSYS.DRUE", line 24
    ORA-06512: In "CTXSYS.DRVDDL", line 452
    ORA-06510: PL/SQL: User Defined Error
    BTW:
    My oracle 10g run on linux AS3 box with 4xP4 and 6G Mem.
    I set pga_aggregate_target=2200M, and at the beginning of creating index, the max pga alloced is about 1100M, but when one patition finished, the error arised and the max pga alloced suddenly reached 3500M. So in every times, the index status is always like below:
    P1_ix usable
    P2_ix Inprogress
    P3_ix Inprogress
    P4_ix Inprogress
    P5_ix Inprogress
    Thx for any help!

    Try to increase LARGE_POOL_SIZE.
    PGA_AGGREGATE_TARGET is not only parameter that can meddle in parallel execution.
    Looks like parallel execution parameters is not correctly set. Check it all, including PARALLEL_EXECUTION_MESSAGE_SIZE.

  • Syntax for building all indexes on a table

    I know the syntax for re-building of index on a table like :
    ALTER INDEX index_name REBUILD;
    But, what is the syntax to re-build all the indexes on a table with one statement.
    I hope, my question is clear. Please help in solving the doubt.
    regards.

    This is a Syntax for building all indexes on a table

  • Problem Queries on tables with multiple domain indexes

    I recently came across an issue in which the development team added a second context index to a table; that is, there was a context index on "title", and a second one was created on "summary".
    Text queries on the new index do not always return results -- In one example, I get 77 rows querying the title, and 5 querying the summary (which, for the purposes of this explanation, always includes the title).
    e.g. contains (title,'matha',1)&gt;0 --&gt; 77 rows
    contains (summary,'martha',1)&gt;0 --&gt;5 rows
    Inspection of the tokenlists shows that the correct pkeys are associated with the expected tokens, and the index is up to date.
    So -- when I was asked to take a look at this, I vaguely recalled some issues with this functionality -- but I can't find any reference to this. The closest thing I could find was reports of problems when multiple contains clauses exist within the same query -- and that is not what is happening here.
    What I would like to do is recommend moving to a single index with a multi-column datastore, and some reference to a bug # would make the process much faster.
    Does anyone recall this issue?
    DB Version 9.2.0.7
    Sun Solaris 10

    e.g. contains (title,'matha',1)&gt;0 --&gt; 77 rows
    contains (summary,'martha',1)&gt;0 --&gt;5 rowsYou have searched for 'matha' without an 'r' in your first example and 'martha' with an 'r' in your second example. I don't know if this was just a typo in your post or if that could be the problem. If it is not the problem, can you post a reproducible test case or at least a copy and paste of an actual run of the two queries using the two contains clauses and the results of the count(token_text) for the search value from the dr$...$i domain index tables. I recall problems with two contains clauses in one query using an 'or' condition, but not with just one contains query where two context indexes exist.

  • Indexes with multiple columns v/s multiple indexes with single column

    Hi Everyone,
    I have a table with below structure
    Create Table Test_Table
    Col1 int,
    Col2 int,
    Col3 int,
    Col4 int,
    Col5 int,
    Col6 int,
    Col7 int,
    Col8 bigint
    Col9 money
    Col10 money
    Now this table is being used in various reports. Since reports need various data, the filter clause for the report’s have various combination of table columns
    Example, Report 1 can have query like
    Select * from Test_Table where col1 = @val1
    Report 2:
    Select * from Test_Table where col1 = @val1 and col2 >=@val2
    Report3:
    Select * from Test_Table where col1 = @val1 and col2 >=@val2 and col3 =@val3 and col4 in(@val4)
    Report4:
    Select * from Test_Table where col1 = @val1 and col2 >=@val2 and col4 = @col4
    And many more combinations.
    Currently the table has many combinations of indexes
    Index1: col1, col2
    Index2: Col2
    Index3: col1, col2, col4
    Index4: col3 include (col9)
    Index5: col1, col2, col3, col4, col9
    Now I am into a performance issue where I have to create one more index with a slight variation from the existing combination of columns.
    Can you please let me know instead of having these various combination of indexes can I create multiple indexes on individual columns.
    Considering the above 4 examples which I have given for 4 reports, if I create 4 indexes separately on 4 individual columns col1, col2, col3, col4 will it be effective on all4 reports?
    Please suggest me the best way to create indexes on this table
    Thanks in advance,
    Raksha

    Do you really need to bring all columns ? Do not use SELECT *.
    Just a guess try index on col1, col2, col3, col4
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for

  • Opening and closing balance diff.In T.code FBCJ

    Hi exports, While we r checking Fbcj T.code for a day, the the closing balance of the day is difference for the next day opening balance.What is the reason behind that. Eg. In FBCJ- 30.3.2010       closing balance is      46,888.00/- 31.3.2010      

  • Why does font always install with error?

    I'm trying to install the free font Xenophobia.  I've downloaded it from five different locations and always get the 'name' table structure error when installing.  Are some fonts just not compatible with MAC OS X?

  • Taking time data from external system(KRONOS) into SAP

    Dear Friends, I have to intergrate my time managemnt to time recording machine(KRONOS) am not aware about that it's sap certified or not .How we can access the data from that machine and insert in sap tables that means we have to communicate sap to n

  • Search cluster PCL4 user-exit or BADI, enhancement

    Hi, i need to add some code when the system has finished to record the PCL4 cluster (HR), but i don't find user-exit or BADI's. Thanks for your help.

  • PO Discount

    Hi, When we enter discount etc. at header level, the price of the material automatically discounted and it will be printed after the discount value.  The requirement is how to print the po with actual value (as quoted by the vendor) and put discount