Live Coding: Discovering DuckDB on Thursday, June 20 at 10 AM!

I just installed the DuckDB test image on my prod :partying_face:

My prod has been running since February with more than thirty Zigbee devices + one camera.

I currently have 996k sensor values in the database:

The migration took 1 minute 20 seconds on my setup:

2024-08-06T21:10:19 DuckDB: Migrating data from SQLite
...
2024-08-06T21:11:47 DuckDB: Finished migrating DuckDB.

(As a reminder, the migration is non-blocking so during that time my instance was running without issue)

Before / after:

SQLite database: 905 MB
DuckDB database: 18 MB

That’s impressive!

What’s even more impressive is the responsiveness of the charts.

I can easily display months of temperature history, it’s very smooth and the values look much cleaner because 2 issues are now solved by this tech:

  • No weird rounding outside the 24h view on the charts
  • There are only "live" data anymore, so the last hour’s data is visible on all charts!

Cleaning up old values

I clicked on "purge SQLite states":

The purge took 12 minutes on my setup.

Database cleanup

I ran a database cleanup, which was almost instantaneous for me.

Then I restarted Gladys.

The result

1008K Aug  6 19:34 gladys-production.db
32K Aug  6 19:34 gladys-production.db-shm
278K Aug  6 19:34 gladys-production.db-wal
3.1M Aug  6 19:11 gladys-production.duckdb
15M Aug  6 19:34 gladys-production.duckdb.wal

Total = 19 MB

With a previous size of 905 MB, that’s -97.9% :star_struck:

I’ll keep monitoring my instance over the next few days and see how it goes :slight_smile:

8 Likes