MySQL Forums
Forum List  »  MyISAM

is it normally ?
Posted by: Yuri
Date: November 05, 2005 03:28PM

mysql 5.0.11
query_cache_size=0

DROP TABLE IF EXISTS `bbb`;
CREATE TABLE `bbb` (
`k1` char(45) NOT NULL default '0',
`k2` char(45) NOT NULL default '0',
PRIMARY KEY (`k1`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 ROW_FORMAT=FIXED;

INSERT INTO `bbb` VALUES ('1','1'),('2','2'), ... ,('200000','200000');

(1)
SELECT * FROM `test`.`bbb` where right(k1,4)='1899'; 0,1411 sec +-0,00xx sec
SELECT * FROM `test`.`bbb` where right(k2,4)='1899'; 0,1411 sec +-0,00xx sec
or
(2)
SELECT * FROM `test`.`bbb` where k2*1='1899'; 0,1531 sec +-0,00xx sec
SELECT * FROM `test`.`bbb` where k1*1='1899'; same
and if
SELECT * FROM `test`.`bbb` where k2='1899'; 0,1334 sec +-0,00xx sec
SELECT * FROM `test`.`bbb` where k1='1899'; 0,0007 sec

if change char(45) -> INTEGER same result (no speed up if search in index column),
search in a column k1 take same time as in a column k2.

even if u try to add
`k3` char(45) NOT NULL default '0',
`k4` char(45) NOT NULL default '0',
`k5` char(45) NOT NULL default '0',
`k6` char(45) NOT NULL default '0',

same result.

is it normally for index column for (1), (2) query?
same way in other Storage Engines

Options: ReplyQuote


Subject
Views
Written By
Posted
is it normally ?
2556
November 05, 2005 03:28PM
1688
November 05, 2005 09:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.