Reputation: 1109
I've a sqlite3 database in python which increments every second as new data arrives from sensors. I need to read the latest value only
However if there's 50 entries which I've already read once, with a new entry, I have to read all 50 items again before the 51st item
I want to avoid reading through the same data over and over so I've added a "ReadStatusFlag" column which will be 1 if unread and flagged to 0 once read to avoid. Primary key is TimeStamp.
Is there any better way? just want to explore various approaches.
Upvotes: 0
Views: 128
Reputation: 416
Select * from DataLog ORDER BY TimeStamp DESC LIMIT 1;
Adjust for your framework.
Upvotes: 4