Services Products About Us Case Studies Clients
Modern Signal
Modern Signal Home Page
Lighthouse on beach About Us
Offering a full range of development services: strategy, design, application programming, database development
News & Recents Projects
SQL Server Query Performance
This page houses tips and tricks for improving query performance in SQL Server.

POSTED BY: Adam Polon

After running into some very quirky results from seemingly simple queries, I have found the following suggestions to make an enormous difference in query performance. 

Of course, you should always start by making sure that your query is optimized using standard practices, such as the following:
  • Make sure fields that are searched over frequently have indexes assigned.  This only makes sense if the field will return less than 10% of the table, so don't index status fields if there are only 5 of them, etc.
  • Make sure the data type for a field is appropriate.  For instance, if your field contains numeric data, avoid using a varchar field and CASTING AS INTEGER.
In some cases, switching around the order of fields in WHERE clauses makes a difference, but I usually do not find this to solve my issues.

Here are some things to try next.

---------------

Debug sluggish queries in SQL Server Management Studio by toggling the “Include Actual Execution Plan” button.  This will allow you to see the execution plan – including any table scans, index seeks, etc, to identify slow points in the query.

---------------

Review the nightly database maintenance plan to ensure that indexes are rebuilt on a nightly basis. 

-----------------

I believe that the rebuilding of indexes on a nightly basis makes the following item unnecessary, but it is listed here just in case in helps where other avenues do not. 

Defragment indexes on large tables. To do this, use the following command:

DBCC INDEXDEFRAG (database_Name, 'table_name', index_name)

Calling this command on key data tables made a huge difference in performance for a few queries that were performing slower than expected.  Queries literally went from 45 seconds to 2 seconds.

It would be a good idea to schedule these commands to run on a nightly or weekly basis.

----------------

Run Update Statistics on key data tables.  In conjunction with DBCC INDEXDEFRAG, I have seen huge performance enhancements as a result of running this.  To do this, use the following command:

update statistics table_name;

It would be a good idea to schedule these commands to run on a nightly or weekly basis.

---------------

Please let me know if you wish to add any additional tips and tricks to this page.




October 1, 2009 --

Modern Signal launches the new website for Charm City Run.The site features a complete redesign, full content management system, enhanced admin tools to manage events and programs, and an events calendar. -View-

August 3, 2009 --

Modern Signal launches a redesigned website to showcase the 2010 International Builders’ Show. Along with other functionality additions, we’ve integrated Google search appliance to produce faster and more precise search results. –View the site-

June 29, 2009 --

Modern Signal launches several features for The NALP Foundation for Law Career Research and Education website: a front-end bookstore with shopping cart functionality, back-end products and orders administration tools, and a front-end donation form. A full e-commerce system was also implemented to support the front-end features.  -View-

May 13, 2009 --

In conjunction with Levine & Associates, Modern Signal launches newly structured Lamb, Beef, and Trade web sites for Meat and Livestock Australia, Ltd. (MLA). The 3 sites, including Spanish versions, are powered through a shared CMS to streamline and consolidate content creation. With this launch, an admin tool was also implemented to manage recipes across all sites. 
-- View portal page to all sites --

January 26, 2009 --

A newly redesigned website is launched for Woodbourne, a private nonprofit child welfare organization.  The launch included a new design, full CMS, video integration on the homepage (video by Houpla!), contact us form, and an I-frame admin tool for staff to manage Google maps displayed in the site. -View-
January 9, 2009 --

Modern Signal launches the new website for NALP, The Association for Legal Career Professionals.  The site features a complete redesign, full content management system, members-only content, online bookstore, blogs, and advertising management tools for NALP staff. -View-

December 12, 2008 --
Dance USA
Phase II of Dance/USA website redesign and development project has launched. The new launch features a full Content Management system, homepage flash design, news/promotions tool, as well as a full events registration module. -View-
November 2008 --

In conjunction with Burka Studios, Modern Signal designed and developed the JStreet Companies website. The website launch included a new design, full CMS integration, residential listings tool and MRIS integration. Through the site, users can search for residential properties that are either listed by the Randall Hagner company or are listed by MRIS. Users may also save their favorite listings, search for agents and submit their own listings for sale by Randall Hagner. -View-