Menu

Writes stalled 2.7 seconds behind a report query, and the fix emptied my backups
📰

Writes stalled 2.7 seconds behind a report query, and the fix emptied my backups

DEV Community: flask·superfire0625·6 days ago
#4TSviHfE
#devtoflask#devto#dev#file#backup
Long article (1524 words) — no AI summary yet.
Reading 0:00
15s threshold

The database is 44 KB. Eleven pages of 4096 bytes. I checked it twice before I believed the number.

That file holds the purchase and sales ledger of a small trading business: nine tables, 31 products, 30 purchase records, 10 receipts, 38 line items. The app on top is 625 lines of Flask, ten routes, 22 write statements, fifteen commit() calls. There is no explicit index anywhere in the schema. It has run since September for four people over office WiFi. I have been telling people this design is enough without ever putting a stopwatch on it.

So I did. Everything below comes from copies of that file on one Windows laptop, Python 3.13.14, SQLite 3.53.1.

The question was narrow. When one person opens the report page, does everyone else's save wait? The answer is yes, and the number is worse than I guessed.

The cost of one open report

Eight threads, each inserting a single row and committing, twenty times.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.