|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Yesterday @ 5:54 AM
Points: 20,
Visits: 143
|
|
Hi All,
I have a table named "Tbl_Inv" in my database that contains 4.7 Lacs records with six non clustered indexes on below mentioned columns:-
ROWID, DOC_CAT, DOC_NO, I_CODE, BOXNO, AMT+GL_CODE
This table does't have any clustered index.
So Please help me and tell me should i create more clustered indexes or i need to create clustered index for fast query results.
Thanx.
Neel
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Thursday, April 04, 2013 8:11 AM
Points: 669,
Visits: 240
|
|
Hello, First off all I would suggest to create a unique clustered index, on the column that is a primary key. In Your case this would be the ROWID column. Further IF is possible to change table schema structure, I would create a new column to act as the primary key, instead of ROWID, let's call it UID, using the most narrow data type SMALLINT, INT or BIGINT to further improve the unique cluster index efficiency.
Important to remember! : You can create only one (1) clustered on a table, regardless the fact that is unique or not. Internally the db engine ensures the uniqueness of it.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, April 25, 2013 5:27 AM
Points: 18,
Visits: 79
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: 2 days ago @ 4:02 AM
Points: 3,131,
Visits: 1,056
|
|
Create an Clustered index. Try to minimize the no of non clustered by creating include indexes.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 5:59 AM
Points: 1,075,
Visits: 5,114
|
|
Are you facing any performane issues?
Indexes are query specific. So, please post your SQL statement and execution plan.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 5:59 AM
Points: 1,075,
Visits: 5,114
|
|
Use sys.dm_db_index_usage_stats to know the effectiveness of your existing indexes.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 12:59 PM
Points: 37,640,
Visits: 29,895
|
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Yesterday @ 5:54 AM
Points: 20,
Visits: 143
|
|
Hello MSzI,
Firstly very thanx for your reply and According to your suggestions :-
I created clustered index on ROWID column that is a primary key and i include DOC_CAT, DOC_NO, I_CODE, BOXNO, AMT+GL_CODE into one non clustered index.
After this i running query "Select * from "Tbl_Inv" then it taking 1.24 minutes but before this it was taking 2.53 minutes to complete
Is it right or pls suggest some technique that i need to do something different for fast query result because i need to minimize result time near at 50 seconds.
Thanx
Neel
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 5:59 AM
Points: 1,075,
Visits: 5,114
|
|
neellotus07 (9/27/2012) ...After this i running query "Select * from "Tbl_Inv" then it taking 1.24 minutes but before this it was taking 2.53 minutes to complete... Have you cleared the buffer before doing this bench marking?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 5:59 AM
Points: 1,075,
Visits: 5,114
|
|
neellotus07 (9/27/2012)
After this i running query "Select * from "Tbl_Inv" then it taking 1.24 minutes but before this it was taking 2.53 minutes to complete
Why are you SELECTing all the 4,70,000 rows? Why don't you use WHERE condition?
|
|
|
|