Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 25th, 2003, 03:57 AM
ganninu ganninu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 ganninu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
arithmetic related!

I have a software which monitors the number of bytes downloaded/uploaded. The value is updated every 60 seconds so that it can be graphed. A typical table would be:

day month year time totalbytes bytes
24 11 2003 10.00 20 20
24 11 2003 10.01 20 0
24 11 2003 10.02 30 10
.
.
.
31 11 2003 01.00 340 15
.
.
01 12 2003 03.45 500 25
.
.

,where 'totalbytes' depicts the total number of bytes since the very first time the software was used, and 'bytes' is the number of bytes downloaded for that monitoring period (of 60 seconds).

My aim is that everytime i log in, i know the total value of bytes i've downloaded during that month - I'm trying to do it in two ways:

(1) I subtract the 'totalbytes' value at the 1st day of the month from the current 'totalbytes' value. This is ok but has a big downside that it excludes the downloaded value of the first day (arithmetic-wise)

or

(2) I select all the 'bytes' values and add them up for that month. This works fine. But this incurs more load since I have to add thousands of values (one value for every minute, thus, for one month of 31 days, I have to add 44,640 values, which I'm trying to avoid!!)

My question is whether there is some SQL syntax which i'm missing, which could be used to tackle my somehow-looking-simple-problem in an efficient manner - i.e. knowing the totalbytes (which is an always cumulative value) since the first time i used the program, how can i get the number of bytes downloaded from the 1st day of that month till the date of making the query?


thanks in advance - ganninu

Reply With Quote
  #2  
Old November 25th, 2003, 10:40 PM
alam alam is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 67 alam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 17 sec
Reputation Power: 6
what if you split the load?
- create a temp table, everytime data updates, it will add and store total to the temp table? Just do a simple select on the temp table, it will return "total" for you.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > arithmetic related!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT