Category Archives: Hidden Gem
When people hear “online schema change” in the MySQL and MariaDB world, many immediately think about pt-online-schema-change. And for good reasons: for years, changing a large table in production was one of those tasks that could ruin your day.
Recently, I discovered that MariaDB includes a very useful hidden gem I completely missed: the ability to update a table schema without blocking concurrent DML statements for the duration of the schema change. [1]
As you probably already know, MariaDB Server supports multiple schema change algorithms.
This is an overview summary:
| ALGORITHM=INSTANT | Metadata-only change. |
…
Continue reading “MariaDB Hidden Gem: Online Schema Change without pt-osc”
Have you ever written a query where the GROUP BY was easy, but the aggregate was the problem?
You know how to group the rows.
You know what result you want for each group.
But none of the built-in aggregate functions really match your logic.
So you end up with a long expression using SUM(), CASE, IF(), GROUP_CONCAT(), JSON functions, or application-side code. It works, but it is not beautiful. And if you need the same logic in several places, it becomes even worse.
This is exactly the kind of problem MariaDB’s CREATE AGGREGATE FUNCTION solves.
…
Continue reading “MariaDB Hidden Gem: Create Aggregate Function”