Lost Password?

Go Back   CodeCall Programming Forum > Software Development > General Programming

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-09-2007, 03:20 AM
Vantage Vantage is offline
Newbie
 
Join Date: May 2007
Posts: 1
Credits: 0
Rep Power: 0
Vantage is on a distinguished road
Default Best way to save lots of small values (in a database)?

Hello!

I'm working with a project that collects sensor data from up to 50 sensors every second. The data is small, only a byte/sec. Every second the application produce 50 * 1 byte = 50 byte's that I'm supposed to store.


Today I have solved this in this way:

During run-time I have an array with sensor objects, every object holds information about the sensor and performs some calculations. The object holds an array with bytes that increases with one byte every second. This is managed by .NET.

When I'm finished, I save every array from the sensor objects to a text file on the hard drive, I set the file name to a GUID. I store the GUID in the object and then I save the object information to a database. When I need the sensor data I read the GUID from the database and find the corresponding file...


This approach work of course, but is it the best way to go? The reason I did this was because it felt strange to save 1 byte to a new row in the database. For every 1 byte I need a unique identifier, right?? Felt like a lot of over-head?

Or is there good ways of storing lots of small values produced every second in a database?


Best regards/
Magnus
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-14-2007, 06:36 AM
TkTech TkTech is offline
 
Join Date: Jun 2006
Posts: 918
Last Blog:
Having trouble with yo...
Credits: 49
Rep Power: 20
TkTech is on a distinguished road
Send a message via MSN to TkTech
Default

Well, how accurate does the sensor read out need to be? Is this for heart surgery or a battlebot? If absolute precision isn't necessary, I would just collect samples and save the averages - ie: every 5 seconds as opposed to every second.

Plus, each row in a mysql db doesn't require very much memory. Having only 1 byte per row is perfectly fine, as long as you don't exceed 2,147,483,647 entries...
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-14-2007, 07:57 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 7,142
Last Blog:
Tramp Variables
Credits: 1
Rep Power: 20
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

I agree, saving one byte per row is fine and a better option than saving to a text file. You say a lot of overhead but it sounds like you have just as much overhead writing to a text file and then to the DB as well. How far back do you need to save data? Do you need data from 30 seconds ago?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Don't hesitate to ask any questions that you have! Check out our
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving Access Database tigger Visual Basic Programming 0 07-06-2007 12:27 AM
Best program for SQL database manipulation Rhadamanthys Database & Database Programming 3 07-02-2007 02:32 PM
Help! Can't get values into database thesquirrel16 Database & Database Programming 5 04-21-2007 05:13 PM
Small job - Database extraction - Delphi 7 of compliant paul. Request Services (Paid) 4 04-11-2007 11:41 AM
Sudoku can be solved using SQL..Take a look! roger Database & Database Programming 5 07-04-2006 02:20 PM


All times are GMT -5. The time now is 12:27 AM.

Contest Stats

Xav ........ 1024.41
MeTh0Dz|Reb0rn ........ 974.08
morefood2001 ........ 850.04
John ........ 841.93
WingedPanther ........ 661.52
marwex89 ........ 575.59
Brandon W ........ 447.33
chili5 ........ 292.12
orjan ........ 187.41
Steve.L ........ 181.88

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 79%

Ads