---
title: "My First *real* SQL optimization (and some good resources)"
url: "https://osherove.com/blog/2003/12/25/my-first-real-sql-optimization-and-some-good-resources.md"
canonical: "https://osherove.com/blog/2003/12/25/my-first-real-sql-optimization-and-some-good-resources.html"
published: "2003-12-25T21:23:00"
updated: "2003-12-25T21:23:00"
tags: [".Net Original", "Cool Articles"]
author: "Roy Osherove"
description: "Yeah, I know how to design a database and normalize tables, but this is some optimization stuff I never had to do. It was fun! We recently encountered the task of optimizing a stored procedure that was taking very long…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# My First \*real\* SQL optimization (and some good resources)

By Roy Osherove December 25, 2003 In [.Net Original](https://osherove.com/blog/category/net-original), [Cool Articles](https://osherove.com/blog/category/cool-articles)

**Historical article** · Originally published December 25, 2003; technical details may be outdated.

Yeah, I know how to design a database and normalize tables, but this is some optimization stuff I never had to do. It was fun!

We recently encountered the task of optimizing a stored procedure that was taking very long to perform its business. It wasn’t that complicated but it was operating on a large table (350,000 records). The table has indexes on the columns in the select clauses but the procedure still took about 19 seconds to do its work.  (Thanks for the help, [Santo](http://weblogs.asp.net/asanto)!)

[Some interesting lessons (and resources) came up from this experience](http://weblogs.asp.net/rosherove/articles/OptimizingExperience.aspx)(article)

And here are some very good resources on optimization in SQL server:

1.    [SQL Server execution plan analysis](http://www.sql-server-performance.com/query_execution_plan_analysis.asp)
2. [Tips for Using SQL Server Query Analyzer](http://www.sql-server-performance.com/query_analyzer_tips.asp)
3. [The Best SQL server performance tuning tips from SQLTeam](http://www.sql-server-performance.com/best_sql_server_performance_tips.asp) (some amazing stuff here!)
4. [Identifying performance issues using SQL Server Profiler](http://vyaskn.tripod.com/analyzing_profiler_output.htm)
5. [SQL Server Performance - Common Symptoms and Tools (Part I)](http://www.sqljunkies.com/Tutorial/7F8518F9-FDAA-4FF3-8FC5-25E8946C8D0C.scuk)
6. [Inside SQL Server: Parse, Compile, and Optimize (intro to the query processor)](http://www.sqlmag.com/Articles/Index.cfm?ArticleID=7446)

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Dec 29, 2003

    ### [Another article of mine published on MSDN: Search Dynamically for Plug-Ins](https://osherove.com/blog/2003/12/29/another-article-of-mine-published-on-msdn-search-dynamically.html)

- Dec 27, 2003

    ### [Code: CRUD base classes for unit testing](https://osherove.com/blog/2003/12/27/code-crud-base-classes-for-unit-testing.html)

- Dec 20, 2003

    ### [Problem and solution: Renaming htm file to aspx may cause javascript trouble](https://osherove.com/blog/2003/12/20/problem-and-solution-renaming-htm-file-to-aspx-may-cause-jav.html)

- Dec 19, 2003

    ### [Service announcement: Feedable and Regulator live again, and Norway tips](https://osherove.com/blog/2003/12/19/service-announcement-feedable-and-regulator-live-again-and-n.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
