Re: [sqlite] inserting new data only

2020-02-26 Thread Simon Slavin
On 26 Feb 2020, at 5:18pm, Przemek Klosowski 
 wrote:

> This 'store only changed values' is
> intended for situations like that.
> Another suitable candidate for that treatment might be a status, for
> instance 'on battery' value for a UPS monitoring system. I can't think of a 
> scenario where storing it every time would be better.

Suppose some horrible disaster happens to your chemical plant at 4pm.  Your log 
for a particular sensor shows an acceptable value, but the timestamp on that 
reading is 3:15pm.  But only changed readings are logged.

Perhaps a fault occurred in the sampling circuit at 3:16pm, so no further 
readings were taken, so an alarm was not raised.  Had every reading been logged 
you could have proved that another reading was taken at 3:58pm still showing 
the same acceptable value.

So it depends why you're doing what you're doing.  Different circumstances 
suggest different tactics.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] inserting new data only

2020-02-25 Thread Simon Slavin
This strikes me as best solved in the programming language.

If a single set of data points is being acquired in real time, and you have a 
programming language (or script) generating the INSERT commands, why not simply 
keep the most recently inserted temperature in a variable ?

On the other hand, if you have multiple sensors, or out-of-order insertion, or 
a stateless insertion program, you could insert every reading and before 
reporting use a 'cleanup' procedure to remove redundant readings.

Both the above would be faster than having SQL execute a search every time a 
new reading is added.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users