•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,576 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,256 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 774 | Replies: 0
![]() |
•
•
Join Date: Apr 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hey, first poster here:
I'm not actually running on MySQL (I'm using MS), but my question is more of a design issue. The model I've been using is perfect for maintaining relationships between data logging devices I have in the field, and so-so in keeping an aggregate of that data stored somewhere. However, I'm wanting to keep a history of the data packets also, which presents a problem.
Currently I have decided to have a resolution of one hour for histories, and so there's a table that has three columns: DateTime Hour, Int64 DeviceId, Int Value. The first two are indices, where DeviceIds are indexed by Hour. The Hour column is set to the first second of every hour that there is data collected, and Value contains the aggregate of all data collected at the device DeviceId.
The problem comes when I'm getting all of this data externally -- there comes a time when I need to insert or update the history of this device, but I don't know if the current hour exists in the history database. Now I can only run an UPDATE and INSERT upon exception, where the Hour and DeviceId match the data I'd like to update with.
Is this the only way to do this? Is this a good way to do it? It doesn't seem like it. Also, is there a better model for this?
I'm new to this field. . .
Thanks,
Brandon
I'm not actually running on MySQL (I'm using MS), but my question is more of a design issue. The model I've been using is perfect for maintaining relationships between data logging devices I have in the field, and so-so in keeping an aggregate of that data stored somewhere. However, I'm wanting to keep a history of the data packets also, which presents a problem.
Currently I have decided to have a resolution of one hour for histories, and so there's a table that has three columns: DateTime Hour, Int64 DeviceId, Int Value. The first two are indices, where DeviceIds are indexed by Hour. The Hour column is set to the first second of every hour that there is data collected, and Value contains the aggregate of all data collected at the device DeviceId.
The problem comes when I'm getting all of this data externally -- there comes a time when I need to insert or update the history of this device, but I don't know if the current hour exists in the history database. Now I can only run an UPDATE and INSERT upon exception, where the Hour and DeviceId match the data I'd like to update with.
Is this the only way to do this? Is this a good way to do it? It doesn't seem like it. Also, is there a better model for this?
I'm new to this field. . .
Thanks,
Brandon
Last edited by brandon.arnold : Apr 13th, 2007 at 1:05 pm. Reason: Typos, etc.
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Web Graphic Programs....Design? (Graphics and Multimedia)
- Design a Banner: $15 gift certificate (Internet Marketers' Lounge)
- Program design tools (C++)
- Web Site Design Help (Site Layout and Usability)
- New Design! (DaniWeb Community Feedback)
- Working on new design (DaniWeb Community Feedback)
Other Threads in the MySQL Forum
- Previous Thread: help with error ORA-00907
- Next Thread: Python Tuples and Mysql Query


Linear Mode