| Previous 30 Newer Entries | Showing entries 31 to 38 |
The slides for my presentation at FOSDEM 2010 are now available online at slideshare. In this presentation I describe a successful client implementation with the result of 10x performance improvements. My presentation covers monitoring, reviewing and analyzing SQL, the art of indexes, improving SQL, storage engines and caching.
The end result was a page load improvement from 700+ms load time to a a consistent 60ms.
10x Performance Improvements – A Case Study View more presentations from Ronald Bradford.After reading Fernando Ipar’s interesting post on partial indexes for string columns, there were two things I wanted to note:
First, this trick works quite well, but only if your like clauses only ever use the wildcard on the right hand side (or not at all). MySQL will not be able to use the index if the like contains a wildcard on the left.
Consider the following table definition:
mysql> show create table people\G
*************************** 1. row ***************************
Table: people
Create Table: CREATE TABLE `people` (
`person_id` int(15) NOT NULL default '0',
`username` varchar(255) default NULL,
`email` varchar(255) default NULL,
PRIMARY KEY (`person_id`),
KEY `people_username` (`username`(5))
) ENGINE=MyISAM
This time, I’m talking about indexes for string typed columns. In particular, I’ll show a procedure I find useful while looking for good index length values for these columns.
I’ll use a sample table called people.
Here’s what it looks like:
mysql> desc people;[Read more...]
+————+——————+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+————+——————+——+—–+———+—————-+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| title | varchar(250) | NO
It is important to know and understand that while indexing columns in MySQL will generally improve performance, using the appropriate type of index can make a greater impact on performance.
There are four general index types to consider when creating an appropriate index to optimize SQL queries.
For the purpose of this discussion I am excluding other specialized index types such as fulltext, spatial and hash in memory engine.
For the following examples, I will use this test table structure.
DROP TABLE IF EXISTS t1; CREATE TABLE t1( id INT UNSIGNED NOT NULL AUTO_INCREMENT, user_name VARCHAR(20) NOT NULL, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(30) NOT NULL, external_id INT[Read more...]
So, how does one gather statistics on indexes? With InnoDB it’s one thing, with MyISAM it’s another thing. This post however, will focus on MyISAM. There are various ways, each having their own drawbacks and positive sides.
What about ANALYZE TABLE? It’s great — very fast in InnoDB. But with MyISAM a lock occurs while scanning the table.
OPTIMIZE TABLE? Still relatively quick with MyISAM, unless the table in question is huge. InnoDB requires an ALTER TABLE — it might take forever, depending on the server configuration, as OPTIMIZE TABLE for InnoDB maps to a ALTER TABLE tableName ENGINE=InnoDB
We all know how ANALYZE TABLE, REPAIR TABLE, and OPTIMIZE TABLE work with MyISAM. However, there’s a less explored way, for MyISAM
I mentioned earlier that I'd blog about progress on the book as we go. It's not only progress on the book itself -- I want to write about the process of writing, because I think it's very interesting and relevant to software engineering. I'm finding a lot of the work in writing a book comes from some of the same things that make software hard: coordinating work, deciding what should go where, and so on.
| Previous 30 Newer Entries | Showing entries 31 to 38 |