MySQL Tips and Tricks

02 avr

In a previous post, I discussed debugging stored procedures with RESIGNAL, which is of great value when troubleshooting errors raised by your stored procedures, functions, triggers, and events as of MySQL/MariaDB 5.5.

However, as of MySQL 5.6 and MariaDB 10.0, there is GET DIAGNOSTICS, which can be used to get the exact error details as well.

RESIGNAL just outputs the error, as it comes from the server, for instance:

ERROR 1146 (42S02): Table 'db1.t1' doesn't exist
02 avr

I was recently debugging a stored procedure and could not easily identify the underlying reason for why it was failing.

It had a standard exit handler catch-all for SQLEXCEPTION, which was:

DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
SELECT ...;
END;

When there was an error, it didn't really output anything useful.

As of MySQL 5.5, there is RESIGNAL:

"RESIGNAL passes on the error condition information that is available during execution of a condition handler within a compound statement inside a stored procedure or function, trigger, or event."

29 Jan
  • Get your Gmail inbox down to zero emails in 15mins without losing anything
  • Create a new email workflow that lets you prioritize emails easily
  • Combine this with at-a-glance context for emails and email threads using Gmail’s Labels feature

A bit about me

17 déc

While running a test on MariaDB Enterprise Beta for installing MariaDB Galera Cluster, I thought that this is a perfect environment to check out how to setup a remote log file for the MariaDB Audit Plugin. Although I am using MariaDB Galera Cluster in this case, you can setup a remote log file in the same way, if you are:

  • Using a group of MariaDB Servers with standard replication enabled
  • Using a group of isolated MariaDB Servers
  • Using just one MariaDB Server

What we want to achieve by using a remote log file is:

24 oct

Google DriveBackground: SkySQL is a distributed company. Nearly all of us work from home. To be productive, we need to emulate the best aspects of collaborating as if we were working next to one another. Given that nearly all of us had worked under similar distributed conditions at MySQL AB, we knew what we were getting into when we were founded. Obviously, we wanted to learn from our past experiences when making our choices for tools and processes.

27 juin

We just ran into a nasty InnoDB bug that only seems to exist in MySQL 5.5.25:

An InnoDB update that modifies a rows primary key can trigger some recursive behavior that creates new rows until all disk space is exceeded. This does not affect all primary key updates in general but only gets triggered when a few other conditions are also met, so you're not too likely to run into it, but if you do your mysqld server will waste a lot of IO bandwidth and storage space on this and will usually eventually run out of disk space.

Syndiquer le contenu