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
 New to SQL Server Programming
 Number of calculations

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 projects
Table2: Contains 13500 timesheets
Table3: Contains 516 Periods

Then there are 3 queries:

Query 1: Calculating the total for the periods
Query 2: Calculating working hours + working hours * total of a period
Query 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. :)
Go to Top of Page

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
Go to Top of Page

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'
Go to Top of Page

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.
Go to Top of Page
   

- Advertisement -