At 05:03 PM 6/12/2003 -0600, Chris Webster wrote:
>Curtis Maurand wrote:
>>I'd write a perl script to pool the device and send the data to the database.
>
>Sorry for not being clearer. I can get the data into the database
>fine. Assuming new values or rows are added once per second, how would a
>client program go about polling the database to see when a new value was
>ready? Check # of rows for a column and when it's incremented grab the
>latest value?
>
>--Chris
How about this:
Keep a table with a single row as a status indicator. Whenever you add a
new row of data, update the status record with a new count of samples.
(samples = samples + 1)... You may even find other interesting things to
put in this row for diagnostic monitoring.
Your client application can then check the single row to determine if new
data is available for analysis. It may even be possible to "prescale" some
of the analysis in the status indicator row... for example summary
statistics. Using this model you can also move on to a new status record
when a new time period begins (or with some other criteria) so that you
have a record of summary trends available.
Updating a single record is not likely to cause significant loading since
the same record is always in the database cache and in precisely the same
location. A prepared statement can also help here.
Hope this helps,
_M
Pete McNeil (Madscientist)
President, MicroNeil Research Corporation.