When MySQL gets a query, it is the job of the optimizer to find
the cheapest way to execute that query. Decisions include access
method (range access, table scan, index lookup etc), join order,
sorting strategy etc. If we simplify a bit, the optimizer first
identifies the different ways to access each table and calculate
their cost. After that, the join order is decided.
However, some access methods can only be considered after the
join order has been decided and therefore gets special treatment
in the MySQL optimizer. For join conditions, e.g. "WHERE
table1.col1 = table2.col2", index lookup can only be used
in table2 if table1 is earlier in the join sequence. Another
class of access methods is only meaningful for tables that are
first in the join order. An example is queries with ORDER BY ...
LIMIT. Prior to MySQL 5.6.10 there was a bug in MySQL that made
the optimizer choose inefficient execution plans for this query
type. …
This week we begin to discuss replication features in MySQL 5.6. Ear Candy is a LOAD DATA INFILE bug and using CSV to get beyond it; At the Movies is Suzan Bond talking about "The Art of Self-Sourcing".
Events
Oracle's doing more MySQL tech tours. These seminars will be in
the mornings, and are free. They will be on:
Tuesday, February 19th in Petach Tikva,
Israel
Thursday, February 21st in Oslo and Brussels
…
[Read more]
I'm not the only one to have noticed this, but I spent a
sufficient amount of time banging my head against a
wall finding this out that I thought it important to make more
people aware of this.
While trying to validate new database hardware we were seeing
some serious performance issues in production. Most MySQL
benchmarks using sysbench or pt-playback couldn't reproduce it,
but a simple sysbench 16 threaded filio test on the mysql
partition showed about 1/3 the throughput we would expect.
The fact that much of the hardware was new as well as the OS we
were using made tracking down the cause difficult (changing from
CentOS 5.5 to Scientific Linux 6.)
Finally some of our ops people working on different systems
started noticing similar issues, and they uncovered the XFS
issue. Sure enough -- when took existing hardware, upgraded
to SL6 and ran the same sysbench filio test we immediately saw a …
With data volumes and user populations growing, its no wonder that database performance is a hot topic in developer and DBA circles.
Its also no surprise that continued performance improvements were one of the top design goals of the new MySQL 5.6 release which was declared GA on February 5th (note: GA means “Generally Available”, not “Gypsy Approved” @mysqlborat)
And the performance gains haven’t disappointed:
- Dimitri Kravtchuk’s Sysbench tests showed MySQL delivering up to 4x higher performance than the previous 5.5 release.
- Mikael Ronstrom’s testing showed up to 4x better scalability as thread counts rose to 48 and 60 …
[Read more]Recently we have helped our customer to migrate their entire application stack from one data center to another. Before we were brought on-board, customer had already placed an order for a new set of servers with the new hosting provider. All of them were suppose to be high-end systems – many CPU cores, plenty of RAM and RAID array build on top of SSD drives. As the new machines started being available to us, we began setting up the new environment. At some point it turned out that the new machines were actually slower compared to the several year old systems and their load was much higher under comparable traffic.
We examined several of the new servers and each time the conclusion was that the problems were related poor I/O performance. In the benchmarks a RAID 10 array on Intel SSD 330 Series drives was barely able to achieve 200-300 IOPS in random writes and even that at the cost of …
[Read more]The MySQL database provides top-level performance. Here are two courses to help you get the most out of your MySQL system.
Troubleshooting MySQL Performance With Sveta Smirnova
This 1 day seminar is an opportunity to interact with Sveta Smirnova, MySQL engineer, expert on MySQL Performance and author of MySQL Troubleshooting.
Sign up for this seminar scheduled for February 28th, 2013 in London, England.
Sveta will start from basics, working towards more advanced cases that DBAs would usually need years of experience to identify or …
[Read more]
Queries in MySQL, Sphinx and many other database or search
engines are typically single-threaded. That is when you issue a
single query on your brand new r910 with 32 CPU cores and 16
disks, the maximum that is going to be used to process this query
at any given point is 1 CPU core and 1 disk. In fact, only one or
the other.
Seriously, if query is CPU intensive, it is only going to be
using 3% of the available CPU capacity (for the same 32-core
machine). If disk IO intensive – 6% of the available IO capacity
(for the 16-disk RAID10 or RAID0 for that matter).
Let me put it another way. If your MySQL or Sphinx query takes 10s to run on a machine with a single CPU core and single disk, putting it on a machine with 32 such cores and 16 such disks will not make it any better.
But you knew this already. Question is – can you do something about it?
In case of Sphinx – indeed you can! And with very little …
[Read more]
RDS instance details
- sysbench seeded 100Gb database and then snapshotted
- 1Tb of RDS storage for the database
- RDS MySQL 5.5.27
- Default my.cnf RDS configuration except (find the full 'show
global variables' output at the end of this post)
- performance_schema is enabled
- innodb_flush_logs_at_trx_commit = 0
- provisioning an RDS instance for each instance size / PIOPS configuration from the seeded database. (10 in total)
Test details
- Amazon RDS
- Within an AWS VPC
- US-East
First warm up innodb by running sysbench with options
- oltp table size 1000000000
- max-requests 0
- max-time 300 (5 minute warm up)
- oltp test mode complex
- oltp index …
Get the most from MySQL Server's top-level performance by improving your understanding of performance tuning techniques.
MySQL Performance Tuning Class
In this 4 day class, you'll learn practical, safe, highly efficient ways to optimize performance for the MySQL Server. You can take this class as:
- Training-on-Demand: Start training within 24 hours of registering and follow the instructor-led lecture material through streaming video at your own pace. Schedule time lab-time to perform the hands-on exercises at your convenience.
- Live-Virtual Class: Follow the live instructor led class from your own desk - no travel required. There are already a range of events on the schedule to suit different timezones and with delivery in languages including English and German.
- In-Class Event: Travel to a training center to follow this class.
For more information on this class, to see the …
[Read more](Note: when I’m talking about MySQL I usually assume InnoDB storage engine. Any other case I explicitly tell this is MyISAM or Memory etc.)
I’ve heared an interesting aproach of using Master-slave replication in MySQL.
Thesis
So the theory was that since updates by primary keys are fast and by secondary keys are slow the slave has to be queried for the primary key and then run the updates by the fetched primary keys. To make this in context and more understandable:
Original query
UPDATE table_for_test SET value_to_change = 123 WHERE cond_column_1 = 987 AND cond_column_2 > 765;
This query get splitted to two different query. First query has to be run on the slave to fetch the primary keys:
SELECT pr_id_col FROM table_for_test WHERE cond_column_1 = 987 AND cond_column_2 > 765;
When we have the values we can go to the master and update the necessary records. …
[Read more]