July 26, 2011 at 8:16 am
I have a question on how to optimize t-sql statement in a sql server 2008 r2 database. In my company one database is being redesigned into 9 other tables. This is due to to the one main table having everyrthing in it the entire database needed.
I have a stored procedure that i need to change. This stored procedure in the old database only needed to refer to the one table. Now I need to join 9 tables together to obtain the same information.
**Note this stored procedure is used to supply information into a C#.net 2008 windows application. The application displays information from this stored procedure for users to see. Basically i need all this inforamtion for the new version of the application to work.
Part of the problem is some of the new tables do not contain any inforamtion, since the original may not have contained any information. This, i need to do left outer joins so all rows display.
The new database has one table called 'NEW' that has lots of columns the are separate keys to the new tables.
Thus, can you tell me what to do to optimize this query?
July 26, 2011 at 8:25 am
In your case it's very simple:
You just need to apply query optimisation techniques and your query will fly.
July 26, 2011 at 8:27 am
wendy the devil is in the details;
we'd proably need to see the actual execution plan of the "new" query hitting those 9 tables to offer concrete advice;
that actual execution plan may show, for example, adding an index that includes a couple of columns will greatly enhance the perforamnce...but without the details , we can't help with anything other than generic advice.
Lowell
July 26, 2011 at 8:29 am
If you are looking for optimization techniques and steps, you can visit the site in my signature. Something you might want to try with those empty tables is to load them with dummy data (few hundred thousand rows) and make sure your queries still run fine. That way you won't have to worry about things running slow in the future as they fill up.
Jason
Webmaster at SQL Optimizations School
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply