Wednesday 8 October 2014

SQL Index Optimization concepts and tricks



 Deleting Index

     1. Trying to delete Clustered index when there is relationship between invoice and invoice detail

 
  2.Index will not get deleted if primary key foreign key relationship exist.





    3. If there is Non-Clustered Index which is Non-Composite in Nature in Invoice Table and another table invoice copy which is Non-Clustered but composite in nature, then composite will perform better than Non-Composite.






4  4. If we have a Clustered Index which is non-composite in nature and on another table we have a clustered index which is composite in nature so there is no difference with the performance. Performance remains same in case of composite or non-composite clustered index
    




   5.    Special Point: If Primary key is created then a clustered index is created by default, but if there is a   clustered index on a table then if we create a primary key, Unique NON-Clustered Index is created.




    6.  If there is a primary key clustered Index on invoice which is Non-Composite in nature and there is no index in invoice detail and also on the other side we have another table invoice copy having clustered index with composite in nature and no index on invoice details,then composite property falls great to use as per the performance impact is concerned.




    7. During Join operation,If there is no index in invoice table but there is Non-clustered index on the  second table called Invoice detail then  logical reads are maximum and provide performance issues.
 On the other hand ,we have a clustered index on invoice_copy and Non-clustered index on second  table then logical reads are reduced to 4 which improves performance.
  




8  8. If there is primary key clustered index which is Non-Composite in nature on invoice table and    another table invoice details having composite clustered index,then composite will perform faster  and has higher efficiency.

SQL Index Optimization concepts and tricks

Deleting Index
1.       Trying to delete Clustered index when there is relationship between invoice and invoice detail














2.       Index will not get deleted if primary key foreign key relationship exist











3.       If there is Non-Clustered Index which is Non-Composite in Nature in Invoice Table and another table invoice copy which is Non-Clustered but composite in nature, then composite will perform better than Non-Composite.









4.       If we have a Clustered Index which is non-composite in nature and on another table we have a clustered index which is composite in nature so there is no difference with the performance. Performance remains same in case of composite or non-composite clustered index
   








5.       Special Point: If Primary key is created then a clustered index is created by default, but if there is a clustered index on a table then if we create a primary key, Unique NON-Clustered Index is created.















6.       If there is a primary key clustered Index on invoice which is Non-Composite in nature and there is no index in invoice detail and also on the other side we have another table invoice copy having clustered index with composite in nature and no index on invoice details,then composite property falls great to use as per the performance impact is concerned.












7.       During Join operation,If there is no index in invoice table but there is Non-clustered index on the  second table called Invoice detail then  logical reads are maximum and provide performance issues.
On the other hand ,we have a clustered index on invoice_copy and Non-clustered index on second table then logical reads are reduced to 4 which improves performance.
 












8.       If there is primary key clustered index which is Non-Composite in nature on invoice table and another table invoice details having composite clustered index,then composite will performe faster and has higher effeciency.