Whenever I worked as a DBA, I was reasonably scared by DROP commands. Don’t get me wrong: despite this, I badly wanted to drop obsolete tables. After that, I could more easily ask developers to fix bad practices, like tables without primary keys or without indexes at...
Federico Razzoli
Logging all MariaDB and MySQL queries into the Slow Log
MySQL and MariaDB optionally log slow queries into the Slow Query Log – or just Slow Log, as friends call it. However, there are good reasons to log all the queries, not just some of them. This article shows how to log all available information into the Slow Log. Why...
Understanding tables usage with User Statistics on MariaDB and Percona Server
User Statistics is a plugin for MySQL developed by Percona. It is distributed and enabled by default in Percona Server and in MariaDB. It should be possible to compile it against MySQL, but we did not try. In this article we’ll see a few simple, yet useful queries to...
PostgreSQL Features Missing in Amazon Redshift
Redshift is an Amazon database technology available for AWS customers. It is based on PostgreSQL 8. The codebase was modified to develop a horizontally scalable SQL DBMS, suitable for analytics, and in particular Data WareHouse. Many PostgreSQL features are not...
Why Tables need a Primary Key in MariaDB and MySQL
In MariaDB and MySQL, all tables should have a primary key – especially InnoDB tables. I mentioned this in several articles, see Primary Key in InnoDB: how they work and best practices. But occasionally people tell me that they are not convinced about that, and I have...
Updating triggers in production with MariaDB and MySQL
Sometimes it is necessary to update multiple triggers in production. It may be necessary to do so without causing temporary inconsistencies between them, which could cause a service disruption or lead to write incorrect data into the database. To update triggers...
What does NULL mean in SQL?
There have been endless discussions already if NULL should be implemented in relational databases, and if it should even be included in the relational theory. My favourite quote on this subject is from the person who helped Ted Codd to divulgate – and probably refine...
MariaDB/MySQL: Using views to grant or deny row-level privileges
Relational DBMSs allow to grant users permissions on certain tables or columns. Privileges can also determine what a user can do – typical privileges are SELECT, INSERT,DELETE, UPDATE. Privileges are assigned or revoked using the GRANT and REVOKE statements. But how...
DROP TABLE improvements in MariaDB
MariaDB implemented several improvements to the DROP TABLE statement. We summarise them here. This article will be kept up to date when MariaDB implements further improvements, in the future. Contributions Before listing the improvements, it's worth mentioning that a...
MariaDB RETURNING Statements
Many DBMSs support a way to get information about a rows we just deleted, updated, or inserted. The syntax varies depending on the DBMS, and some of them allow more options than others. Currently MySQL has no similar feature. MariaDB supports the RETURNING keyword for...