Skip to main content
Home
badllama.com
  • Search
  • Log In

mysql

MySQL Partitions

Tue, 07/12/2011 - 21:22 by bchavet

MySQL Partitions are a great way to rotate data in a table without incurring the overhead of running multiple delete statements. The most common use of this is to partition data by date. You must use MySQL 5.1 (or newer, I presume), and it is recommended to use MySQL 5.1.16 or later in order to take advantage of the ALTER TABLE features that allow adding partitions on existing tables.

  • Read more about MySQL Partitions

Analyze MySQL Queries Using tcpdump

bchavet's picture

Thu, 05/26/2011 - 20:23 by bchavet

This is an incredibly useful method of analyzing the queries that your MySQL server is processing without having to change the log level, and subsequently, not having to restart the MySQL server.

First, capture the MySQL queries with tcpdump as they come across the wire

tcpdump port 3306 -s 65535 -x -n -q -tttt > tcpdump.out

When you're done capturing the desired traffic, run mk-query-digest from Maatkit to analyze the tcpdump

mk-query-digest --type=tcpdump tcpdump.out | less
Tags: 
mysql
  • Read more about Analyze MySQL Queries Using tcpdump

MySQL Backups Using LVM Snapshots

bchavet's picture

Thu, 05/19/2011 - 13:36 by bchavet

If your MySQL data lives on an LVM volume, using an LVM snapshot is a great low-impact method of getting a point-in-time backup of your entire database. The only real gotcha is that snapshot must be made while the data files are in a "safe" state (meaning that all of the data has been written to file, and not only present in memory). Here are the basic steps needed to get a backups

Tags: 
mysql
  • Read more about MySQL Backups Using LVM Snapshots

MySQL

Wed, 04/06/2011 - 23:14 by bchavet

Purge Binary Logs

Purging binary logs can free up a lot of space in a crunch. These logs are primarily used for replication, and don't necessarily need to be kept for very long.

  • Read more about MySQL
Powered by Backdrop CMS