Steps to optimize a query that retrieves data by joining 4 tables

Posted by Prabu_Spark under Sql Server on 12/2/2014 | Points: 10 | Views : 407 | Status : [Member] | Replies : 1
Hi,
I need to optimize a query that retrieves data by joining 4 tables, where 2nd table has 1 million records. i need to optimize the query to retrieve the information faster. Kindly give me the solution for this problem.

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Bandi on: 12/2/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Some of the inputs from my side is:

1. Do you have proper indexes on the columns that are used in conditions
2. check whether you can filter the records in the join part itself..

For example,
SELECT * FROM table1 t1 join table2 t2 on t1.Id = t2.FKID
....
....
WHERE <some coniditons>


Instead of joining with whole table, try to join with sub query (SELECT <specific Columns> FROM table2 ) as t2



Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response