23 November 2011

SQL Performance Tips 4

Hi All,

Again me with some more SQL Performance Tips.

If you have a lot of tables with which you have to join and those tables are big then pay attention to the order of how you join those tables because the order matters.

Why the order of the tables in joins matters?

It is because even if the result of your query returns only a few of records, lets say 7 records, it doesn't mean that it will run fast, and it will not run fast because during the first joins your tables can "return" thousands, millions or even more records with which the SQL Server will be working further.

So the idea is that you have to use the Actual Execution Plan to see what is Estimated Number of Rows with which the SQL Server will be working with.

Try to filter the data using the joins, so that less data remains to be processed, and less time it takes to the SQL Server to return the result to you.

Good luck,
Roman

No comments:

Post a Comment

your thoughts are welcome:

Need more? Leave comments and subscribe to my blog.

.