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.
| Author |
Topic |
|
Willio
Starting Member
20 Posts |
Posted - 2006-05-17 : 05:30:46
|
| Users,My question is about the number of calculation made with my database and my query.The situation:Table1: Contains 900 projectsTable2: Contains 13500 timesheetsTable3: Contains 516 PeriodsThen there are 3 queries:Query 1: Calculating the total for the periodsQuery 2: Calculating working hours + working hours * total of a periodQuery 3: Calculating loancosts of a project.Query 3 is using 2 and 2 is using 1. How many calculations are made in total????Thanks!Willio |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-05-17 : 05:33:54
|
| What do you mean "calculations"?How far have you got with this yourself, have you done anything ?If you want to see how much work a query takes, try looking at the query plan, or using profilier.-------Moo. :) |
 |
|
|
Willio
Starting Member
20 Posts |
Posted - 2006-05-17 : 06:08:24
|
| Well i can understand that it takes for example 903 * 13500 * 516 calculation because every project looks in every time-sheet and every time-sheet looks in every period. But is that thue? It will come to a total of 6.359.958.000 calculations :-s |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2006-05-17 : 06:34:32
|
| not absolutely true....normally there would be some relationship between projects - worksheets - periods...and this would help filter the number of calculations downwards. what you have described is a cross-join where all rows are joined to all other rows...but in this case that may not make 'business sense' |
 |
|
|
Willio
Starting Member
20 Posts |
Posted - 2006-05-17 : 08:58:52
|
| Nope it is absolute no many to many relation. Project to worksheet is 1 to many and period to worksheet is 1 to many. So an period has can have more than one worksheets and a project can have more than one worksheet. |
 |
|
|
|
|
|