SQLite Forum

Best way to observe database operations
Login
> like a live stats dashboard.

You may find that simply re-generating the stats view from the current version of the DB is really fast.

(And if not, you probably needed to optimize that query anyway!)

That's not idle speculation. This very forum software has some statistics-generating pages that are dashboard-like, which work by querying a SQLite DB. I just hit a fairly heavy one of these, which did all of the server-side work in 12 ms.

Therefore, you may not actually need instant notification: the reader and writer are on the same machine, so just have the reader re-read the current data from the written DB on each screen repaint. A typical status dashboard updates, what, once a second at most?

I wouldn't be surprised if the cost of the DB hit is actually less than the cost of the GUI update in this case: all of the recently-updated DB data is still in cache, after all.