Skip to content

# Month: February 2010

## Defined your MySQL backup & recovery plan recently?

MySQL Backup Replication February 17, 2010February 17, 2010

Following up on Ronald Bradford‘s Checked your MySQL recovery process recently? post, I wish to add a prequel.

To see whether you have a clear definition of your backup requirements, ask yourself these questions:

- Is there a backup/restore plan?
- Is there a written backup/restore plan?
- How fast do you need to recover a backup? What’s the longest downtime you will allow from the point of failure to the point of restored, functional database?
- How much data are you willing to lose in case of crash? A second’s worth of data? An hour’s worth? A day’s worth? None?
- Are you willing to allow that the database becomes read-only when taking the backup? Or completely down?
- Are you willing to take the risk that the backup will not be 100% compatible with the data? (Backing up your slave holds this risk)
- Is your manager willing to all that you are willing?
- Is the backup plan known to the management team, or do they just know that “the database has backups“?

The above checklist is by no means complete.

I have a vivid memory of a very good sys admin who failed on the last two points. He had some very sour days when recovering a lost file from tape took much longer than was affordable to some contract.

I found that technical people rarely share the same views as marketing/management. Make sure to consult with the management team; they will have a clearer view on what the company can afford and what it cannot afford.

## To not yum or to not apt-get?

MySQL Configuration Installation Linux February 16, 2010February 16, 2010

I’ve written shortly on this before. I like yum; I love apt-get; I prefer not to use them for MySQL installations. I consider a binary tarball to be the best MySQL installation format (source installations being a different case altogether).

#### Why?

I use yum and apt-get whenever I can and for almost all needs (sometimes preferring CPAN for Perl installations). But on a MySQL machine, I avoid doing so. The reason is either dependency hell or dependency mismatch.

Package managers are supposed to solve the dependency hell issue. But package managers will rarely have an up to date MySQL version.

I’ve had several experiences where a simple yum installation re-installed the MySQL version. I’ve had customers calling me up when, having installed something with yum, MySQL would not work anymore. Continue reading » “To not yum or to not apt-get?”

## mycheckpoint (rev. 88): mount points monitoring, improved charting, enhanced auto-deploy

MySQL Graphs Monitoring mycheckpoint February 10, 2010February 10, 2010

Revision #88 of mycheckpoint is released. In this revision:

- Disk space monitoring
- Improved charting
- Enhanced auto-deploy
- And more…

#### Disk space monitoring

mycheckpoint now monitors (on Linux only) three mount points:

1. The “/” (root) mount point
2. The datadir mount point
3. The tmpdir mount point

It may well be the case that two of the above (or perhaps all three of them) share the same mount point. For example, if there isn’t any particular partition for “/tmp“, it is possible that the tmpdir (by default “/tmp“) is on the same mount point as “/“. mycheckpoint does not care.

mycheckpoint monitors and reports the mount point’s used percent, in a similar algorithm df uses.

Disk space monitoring is only possible when monitoring the local machine (i.e. mycheckpoint runs on the same machine as the monitored MySQL server). In the future mycheckpoint may also monitor additional mount points, such as the various logs mount points.

#### Continue reading » “mycheckpoint (rev. 88): mount points monitoring, improved charting, enhanced auto-deploy”

## Monotonic functions, SQL and MySQL

MySQL Indexing Math SQL February 9, 2010February 11, 2010

> In mathematics, a monotonic function (or monotone function) is a function which preserves the given order. [Wikipedia]

To be more precise, a function f is monotonic increasing, if for every x ≤ y it holds that f(x) ≤ f(y). f is said to be strictly monotonic increasing is for every x < y it holds that f(x) < f(y).

So, if we follow values in some order, we say that f is monotonic increasing if f‘s value never decreases (it either increases or stays the same), and we say that f is strictly increasing if f‘s value is always changes “upwards”.

Monotonic functions play an important role in SQL. To discuss monotonic functions in SQL we must first determine what the order is, and then, what the function is.

Well, they both change according to our point of view. Let’s look at some examples. Take a look at the following table: Continue reading » “Monotonic functions, SQL and MySQL”

## Beware of implicit casting

MySQL Indexing SQL February 2, 2010

Ever so often a query provides a “bad” execution plan. Adding a missing index can many times solve the problem. However, not everything can be solved with an index. I wish to highlight the point of having an implicit cast, which negates the use of an index on MySQL.

I see this happening a lot on customers’ databases, and this begs for a short introduction.

#### MySQL doesn’t support index functions

Let’s assume the following table: Continue reading » “Beware of implicit casting”