Home » Performance » MySQL » Need help with under-performing query: using where, temporary and filesort
Need help with under-performing query: using where, temporary and filesort [message #3714] Thu, 13 November 2008 05:23 Go to next message
sameerpanjwani  is currently offline sameerpanjwani
Messages: 5
Registered: August 2008
Junior Member
This is the table:

CREATE TABLE common_categories (
id int(11) NOT NULL auto_increment,
category varchar(255) NOT NULL default '',
category_parent_id int(11) NOT NULL default '0',
category_count varchar(255) NOT NULL default '',
parent_category varchar(255) NOT NULL default '',
visibility enum('Visible','Invisible') NOT NULL default 'Visible',
related_words varchar(255) NOT NULL default '',
did_list text,
PRIMARY KEY (id),
UNIQUE KEY category (category,category_parent_id),
KEY category_2 (category),
KEY parent_category (parent_category),
KEY category_parent_id (category_parent_id),
FULLTEXT KEY category_3 (category),
FULLTEXT KEY related_words (related_words)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


And this is the query:
SELECT title, count(title) as number FROM did_category dc WHERE dc.main_category LIKE 'Business%' GROUP BY dc.title

The table has more than 1 million records and the EXPLAIN shows it using the main_category as the key but it also shows using where, temporary and filesort. I would assume that is slowing down the query. How to avoid that.
Re: Need help with under-performing query: using where, temporary and filesort [message #3722 is a reply to message #3714 ] Wed, 19 November 2008 10:53 Go to previous messageGo to next message
Carsten_H.  is currently offline Carsten_H.
Messages: 9
Registered: August 2006
Junior Member
Well... your table structure is another table than the one you use in your query. Smile
Re: Need help with under-performing query: using where, temporary and filesort [message #3738 is a reply to message #3714 ] Wed, 26 November 2008 04:10 Go to previous message
stark  is currently offline stark
Messages: 11
Registered: July 2007
Junior Member
You can get rid of the filesort by adding "ORDER BY NULL".
Previous Topic:How to speed up DELETE with innodb table
Next Topic:3 way LEFT JOIN with GROUP CONCAT, eliminate using filesort
Goto Forum:
  



Current Time: Wed Jan 7 14:56:05 EST 2009

Total time taken to generate the page: 0.01234 seconds
.:: Contact :: Home :: MySQL Support by Percona.com ::.

Powered by: FUDforum 2.7.5.
Copyright ©2001-2006 FUD Forum Bulletin Board Software

MySQL Performance | Forum authority Badge