Showing entries 25543 to 25552 of 44106
« 10 Newer Entries | 10 Older Entries »
Why InnoDB index cardinality varies strangely

This is a very old draft, from early 2007 in fact. At that time I started to look into something interesting with the index cardinality statistics reported by InnoDB tables. The cardinality varies because it's derived from estimates, and I know a decent amount about that. The interesting thing I wanted to look into was why the cardinality varies in a particular pattern.

Here I'll grab a bunch of cardinality estimates from sakila.film on MySQL 5.0.45 and put them into a file:

PLAIN TEXT CODE:

  1. baron@kanga:~$ while true; do mysql sakila -N -e 'show index from film' | head -n 2 | tail -n 1 | awk '{print $7}'; done> sizes

After a while I cancel it and then sort and aggregate them with counts:

PLAIN TEXT CODE:

  1. baron@kanga:~$ sort sizes | uniq -c …
[Read more]
Scaling writes in MySQL

We use MySQL on most of our projects. One of these projects has a an access pattern unlike any other I've worked on. Several million records a day need to be written to a table. These records are then read out once at the end of the day, summarised and then very rarely touched again. Each record is about 104 bytes long (thre's one VARCHAR column, everything else is fixed), and that's after squeezing out every byte possible. The average number of records that we write in a day is 40 million, but this could go up.

A little bit about the set up. We have fairly powerful boxes with large disks using RAID1/0 and 16GB RAM, however at the time they only had 4GB. For BCP, we have a multi-master set up in two colos with statement level replication. We used MySQL 5.1.

My initial tests with various parameters that affect writes showed that while MyISAM performed slightly better than InnoDB while the tables were small, it quickly …

[Read more]
Installing Lighttpd With PHP5 And MySQL Support On Mandriva 2009.1

Installing Lighttpd With PHP5 And MySQL Support On Mandriva 2009.1

Lighttpd is a secure, fast, standards-compliant web server designed for speed-critical environments. This tutorial shows how you can install Lighttpd on a Mandriva 2009.1 server with PHP5 support (through FastCGI) and MySQL support.

MySQL processlist phrase book

For your convenience, a short phrase book, starting with explanation of process states where MySQL is mostly working to look up data from tables:

  • “Sending data” – reading data from tables (or looking it up)
  • “Copying to tmp table” – reading data from tables (or looking it up)
  • “Copying to tmp table on disk” – query needs a rewrite
  • “statistics” – looking up data from tables
  • “Sorting result” – reading data from tables (or looking it up)

Locking is fun:

  • “update” – There is big chance that it is waiting for a lock, can be updating as well, on busy systems
  • “Locked” – Even bigger chance that it is MyISAM table waiting to be converted to InnoDB

Table opening is even funnier:

  • “Opening tables” – some other idiot thread is holding the LOCK_open or similar mutex
[Read more]
[MySQL][Spider][VP]Spider-2.4 Vartical Partitioning-0.4 released

I'm pleased to announce the release of Spider storage engine version 2.4(beta) and Vertical Partitioning storage engine version 0.4(alpha).
Spider is a Storage Engine for database sharding.
http://spiderformysql.com/
Vertical Partitioning is a Storage Engine for vertical partitioning for a table.
http://launchpad.net/vpformysql

The main changes in this version are following.
- "Engine-condition-pushdown" is available on Vertical Partitioning with Spider.

Please see "99_change_logs.txt" in the download documents for checking other changes.
Thanks to Gennady for bug report.

Enjoy!

Getting apache core dumps in Linux

If you want to get core dumps for intermittent Apache/mod_php crashes in Linux, you will probably need this module (otherwise Linux kernel will refuse to dump core, whatever you put into your OS or Apache configuration):


/*
* Author: Domas Mituzas
* Released to public domain
*
* apxs -c -i mod_dumpcore.c
* and...
* LoadModule dumpcore_module .../path/to/mod_dumpcore.c
* CoreDumpDirectory /tmp/cores/
* and...
* sysctl -w kernel.core_pattern=/tmp/cores/core.%p.%t
*/

#include "httpd.h"
#include "http_config.h"
#include <sys/prctl.h>

static int dumpcore_handler(request_rec *r)
{ prctl(PR_SET_DUMPABLE,1,0,0,0); return DECLINED; }

static void dumpcore_register_hooks(apr_pool_t *p)
{ap_hook_handler(dumpcore_handler, NULL, NULL, APR_HOOK_MIDDLE);}

module …

[Read more]
EXPLAIN – An essential tool for MySQL developers.

Just recently I came across the presentation “Bend SQL to your will with EXPLAIN” by Ligaya Turmelle via the Linked In – MySQL Speakers and Presenters group. Slides available at Slideshare. While I know a little about MySQL, I always enjoy spending time reviewing content when possible, perhaps as a good reference when asked, perhaps to glean some small point of knowledge I didn’t know, or didn’t understand completely, or had forgotten about. It’s also fun to randomly find worthwhile information.

EXPLAIN is an essential tool for MySQL developers, if you don’t know what QEP is, the listed google search link …

[Read more]
DBMS Links of the Week

Image by plαdys via Flickr

The following is a list of interesting DBMS related links for the week:

[Read more]
Changing MySQL storage engine for one table in your Propel/Symfony project

I need one MyISAM table in my schema, I’m using Symfony 1.2 and Propel 1.3. As flexible as Symfony and it’s YAML files are, Propel currently doesn’t allow you to change the storage engine on the fly. You use the storage engine as specified in propel.ini. As discussed in the Propel FAQ .

So, the next best thing to do now is to have it so that when Symfony runs propel:insert-sql, I can piggyback my own SQL to it. Luckily, this is possible, and it’s explained here

I now have my own SQL file running at the end, where I do an ALTER TABLE. For the lazy web.

1. Create your Alter table:

ALTER TABLE `database`.`footable` ENGINE=`MyISAM`;

2. Save the file in $projectdir/data/sql/piggyback.sql

[Read more]
Log Buffer #163: a Carnival of the Vanities for DBAs

Welcome, readers, to the 163rd edition of Log Buffer, the weekly review of database blogs, your sieve

Oracle

First, the ghastly news—Tom Kyte said “I’m not a DBA anymore.” Say it ain’t so, Tom! “After nine years and nine months of running the database that hosts asktom, I’ve retired . . . not from answering questions, but rather from being the DBA and semi-SA for the machine that was asktom.oracle.com.” Okay, so he said it ain’t so.

Meanwhile, Tom’s Oak Table colleague, Jonathan Lewis, played no head games on us, but he has been at the hash …

[Read more]
Showing entries 25543 to 25552 of 44106
« 10 Newer Entries | 10 Older Entries »