Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are a couple of things you can look at to optimize your query performance.</p> <ol> <li><p>Ensure that you just have the minimum of data. Make sure you select only the columns you need. Reduce field sizes to a minimum.</p></li> <li><p>Consider de-normalising your database to reduce joins</p></li> <li><p>Avoid loops (i.e. fetch cursors), stick to set operations.</p></li> <li><p>Implement the query as a stored procedure as this is pre-compiled and will execute faster.</p></li> <li><p>Make sure that you have the correct indexes set up. If your database is used mostly for searching then consider more indexes.</p></li> <li><p>Use the execution plan to see how the processing is done. What you want to avoid is a table scan as this is costly.</p></li> <li><p>Make sure that the Auto Statistics is set to on. SQL needs this to help decide the optimal execution. See Mike Gunderloy's great post for more info. <a href="http://www.developer.com/db/article.php/10920_3622881_1" rel="nofollow noreferrer">Basics of Statistics in SQL Server 2005</a></p></li> <li><p>Make sure your indexes are not fragmented <a href="http://www.mssqlcity.com/Articles/Adm/index_fragmentation.htm" rel="nofollow noreferrer">Reducing SQL Server Index Fragmentation</a></p></li> <li><p>Make sure your tables are not fragmented. <a href="http://www.sql-server-performance.com/articles/per/detect_fragmentation_sql2000_sql2005_p1.aspx" rel="nofollow noreferrer">How to Detect Table Fragmentation in SQL Server 2000 and 2005</a></p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload