Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Which is best? Select from Joins or Single Table

Author  Topic 

channa
Starting Member

5 Posts

Posted - 2008-06-03 : 10:01:52
Hi,

I am using a SP which one has lot of Joins(More than 10 tables).

For every request from user SP executed, and the DB performance got slow.

For this i planned to write a schedule which runs once in an hour to put all the results of SP in to One single table.

I thought if the user selects from single table means the performance will increase.

I don't know whether this one is a right solution.

I am very new to SQL server. Help me for this Problem.

Thanks in advance.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-06-03 : 10:04:57
well the performance will increase but you'll have denormalized data that might go bad.
try indexing all columns that are joined on. this should speed up performance.
also defragment indexes and update statistics regularly.

how big are your table and can you possibly show us your sproc?
since improperly written queries can be great strain on resources.


_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-03 : 10:05:31
A single table will be faster to seek or scan records from than multiple table due to the overhead of the JOIN.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

channa
Starting Member

5 Posts

Posted - 2008-06-03 : 10:11:37
Each table having more than 50000 records.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-06-03 : 10:12:52
that tells us nothing useful. 50k records is nothing.

show us your query.


_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-03 : 10:14:33
Well, the phrase "Each table having more than 50000 records." is true even for tables containing 2 billion records.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2008-06-06 : 03:08:01
Caching data in a separate table is perfectly fine as long as your business rules allow for your users to have "old" data. However, optimizing your query will give you great benifits in many ways...not only will it perform faster using less resources (given that there is any optimization to do) but it's also a great chance to learn some stuff about sql server. If you go about it the right way the people here will teach you ALOT!!

--
Lumbago
Go to Top of Page
   

- Advertisement -