Too Many Afterthoughts

The greatest ideas are often far too late

Latest stories

Johny, the Musical Robot

Johnny the Musical Robot

Long, covid-avoiding lockdown evenings provided me with an ample opportunity to follow up on an old idea I had when I was working with audio processing. I was expecting to discover an issue that would make it a dead-end at some point, but at each iteration I was surprised about how well it worked, so I was left with no other option but to continue 🙂

(more…)

Partitioning InnoDB tables by time-based pseudo-sequential UUIDs

Time Twister Abstract Concept Illustration with Twisted Vintage Clock

Partitioning has multiple uses – spreading load onto multiple disks, cold storage of older data on cheaper disks, and probably others. Most importantly though, partitions are not for performance.

The main use case I’m going to explain is time-based partitioning as a tool for limiting the scope of stored data. This could be required to comply with a data retention policy or simply to save money on disk space.

(more…)

UUIDs Are Bad for Database Index Performance, enter UUID7!

UUIDs, Universal Unique Identifiers, are a specific form of identifier designed to be unique even when generated on multiple machines. Compared to autoincremented sequential identifiers commonly used in relational databases, generating does not require centralized storage of the current state, I.e., the identifiers that have already been allocated. This is useful when a centralized system would pose a performance bottleneck or a single point of failure. UUIDs are designed to be able to support very high allocation rates, up to 10 million per second per machine.

(more…)

Choose the right primary key to save a large amount of disk I/O

Cardboard boxes

Imagine you’re working in a large book warehouse and in charge of new arrivals. There’s a separate, digital system for metadata like authors, categories, etc., so the only information you’ll use during storage is the inventory number. Each book is identified by a unique number with many digits and all books must be findable by their number. To make handling quicker, books are packed in boxes, ordered by the inventory number. When looking for a book, the box must be identified first. Therefore, each box is labeled by the lowest inventory number it contains and the first number that’s in the next box.

Your job in the arrivals room is to pick up books-to-be-stored one by one, assign them a new inventory number in the metadata system, label them by number, and put them in a box as mentioned before. Now, the room is quite small and if you run out of space, you’ll need to move the filled boxes into the basement, which might be two floors down.

(more…)

Touchscreen Stylus Glitching in Linux

I’m using a laptop that comes with a touchscreen plus stylus and after about 3 years the pen input hardware seems to be failing. The problem presents itself by by generating phantom pen movements to a certain area of the screen. It’s impossible to use a normal mouse or touchpad when this is happening.

(more…)

Low-Carb Flaxseed Bread Experiments

I usually eat a lot of bread and wanted to replace it with a non-wheat alternative with lower carbohydrate content. Out of all the nut and seed-based flours, flaxseed seemed to have the least number of calories. I found some recipes on the web, but they were quite varied and I wanted to try a couple of variants, especially because I was using a quicker cooking method.

(more…)

DIY: Increasing the Efficiency of a Badly Placed IR Heating Panel

I recently bought an IR radiant heating panel to cut down on heating cost. The idea is that it heats surfaces instead of the air, so if placed close to people, the overall air temperature can be kept lower than would be otherwise pleasant. It feels like sitting next to a fireplace, although much weaker. Considering the goal, the only reasonable place to put it was the windowsill.

(more…)

“Using index” doesn’t necessarily mean fast lookup in MySQL

Using index in the output of EXPLAIN query

While dealing with slow MySQL queries my go-to approach is to quickly run an an EXPLAIN on the query and check if the indices I expect to be used are actually being used. A quick check is to look at the “Extra” column of the explain output to see if it contains the term “Using index”

However, I found out that “Using index” does not mean what I thought it meant.

(more…)
Too Many Afterthoughts The greatest ideas are often far too late

Pages