|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, January 06, 2011 9:39 PM
Points: 20,
Visits: 101
|
|
I've a performance related issue.
I've one big table A which is been used in one query having join with another big table B. Table A has no Primary key but a clustered index defined on four columns (composite) and two more nonclustered indexes. Table B also has no primary key but a clustered index with five columns (again composite) and three non clustered indexes. All of the indexes are on more than one column.
While running the query, it taking too much time and execution plan shows 23% of sort (execution plan shows its in one of the case statements with "in (select ")) on one column of table A which is part of clustered index. How should I resolve it ? Secondly, what is the significance of PK and clustered index separately ? Table A comprises of 35% of index seek and Table B shows 18% of index seek.
The query comprises of joins between these two tables and inserting in another table. Lots of columns in select statement and also few case statements with "exists (select" in them.
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Thursday, May 16, 2013 8:29 AM
Points: 4,804,
Visits: 8,067
|
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, January 06, 2011 9:39 PM
Points: 20,
Visits: 101
|
|
| Not possible to send execution plan here. I created two new tables form above ones without any indexes and tried after replacing those into the query for a common set of parameters. Created primary clustered key constraint on both tables (with three columns on each table). Thereafter created one non clustered index for the three columns showing 18% in Hash Join in Table A (new one). Still taking approx same time (Just 20 seconds efficiency). Kindly suggest.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 5:49 PM
Points: 37,671,
Visits: 29,925
|
|
Without seeing the exec plan and the table/index definitions, it's really hard to answer these kind of questions. You're just not posting enough information for us to be able to do more than wildly guess.
Why no exec plan?
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Thursday, May 16, 2013 8:29 AM
Points: 4,804,
Visits: 8,067
|
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, January 06, 2011 9:39 PM
Points: 20,
Visits: 101
|
|
| For more information, I took help of sys.dm_db_missing_index_details and other DMVs to check out for missin index details. Table A and B both contains around 64 Lac records and their join result shows around 25k records. Select statement contains few case statements and overall query is taking 3 and half minutes to complete. Table A clustered index seek shows 66% participation.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, January 06, 2011 9:39 PM
Points: 20,
Visits: 101
|
|
Here's the execution plan.....
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 5:49 PM
Points: 37,671,
Visits: 29,925
|
|
Table and index definitions please? I'm guessing you didn't read the article that Gianluca posted.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, January 06, 2011 9:39 PM
Points: 20,
Visits: 101
|
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, January 06, 2011 9:39 PM
Points: 20,
Visits: 101
|
|
| Any suggestions ???? Eagerly waiting your advice... Already tried and tested lots of things but query taking around 3:15 mins at best....
|
|
|
|