Some slow-query-log entries don"t make sense
am 11.10.2006 19:36:22 von Dave HammondHi All,
I'm trying to use the slow-query-log (with
--log-queries-not-using-indexes enabled) to determine if any queries
need optimization, and have a few questions about some entries I'm
seeing.
First question: given a table defined as:
CREATE TABLE `oa_location` (
`rowid` int(11) NOT NULL auto_increment,
`pLocation` varchar(7) NOT NULL default '',
`cLocation` varchar(7) NOT NULL default '',
[...]
PRIMARY KEY (`rowid`),
KEY `oaloc001` (`pLocation`),
KEY `oaloc002` (`cLocation`),
KEY `oaloc003` (`locType`)
) ENGINE=MyISAM AUTO_INCREMENT=448 DEFAULT CHARSET=latin1
Why would this query appear in the slow-query-log:
# Query_time: 0 Lock_time: 0 Rows_sent: 6 Rows_examined: 6
select pLocation from oa_location order by pLocation;
This query apparently took no time, and it used an indexed field.
Second question: given a table defined as:
CREATE TABLE `oa_paycode` (
`payCode` smallint(4) unsigned zerofill NOT NULL default '0000',
`shortDesc` varchar(9) default NULL,
`longDesc` varchar(30) default NULL,
`visible` enum('Y','N') default 'Y',
PRIMARY KEY (`payCode`),
UNIQUE KEY `paycd001` (`payCode`),
KEY `paycd002` (`visible`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
why would this query show up in the slow-query-log:
# Query_time: 0 Lock_time: 0 Rows_sent: 177 Rows_examined: 177
select * from oa_paycode;
Again, the query apparently took no time, and it presumably didn't need
an index (or used the primary key) since all records were requested.
Any explanations or advice would be greatly appreciated.
-Dave H.