indexing - Simple MySQL WHERE query not using Index -



quick answer: query condition needs same type column use index. trying search char column numeric condition.


i have table 15 million rows. have column called 'ticket' can occur multiple times wouldn't occur many times . . . less 10. have created index on column explain command says when using simple 'where ticket =' query not using index. confuses me asking question here.

create table company1.rtable (   `adate` date default null,   `fromd` date default null,   `pno` int(10) default null,   `ticket` char(11) default null,   `r` int(11) unsigned not null default '0',   `line` tinyint(3) unsigned default null,   `nnum` char(11) not null,   `pkey` char(7) default null,   `modnum` char(4) default null,   `dnum` smallint(5) unsigned not null,   `rdnum` smallint(5) unsigned default null,   `ptype` int(10) default null,   `lnum` decimal(9,2) default null,   `lineamount` decimal(9,2) default null,   `amount` decimal(9,2) default null,   `amount1` decimal(9,2) default null,   `amount2` decimal(9,2) default null,   `amount3` decimal(9,2) default null,   `amount4` decimal(9,2) default null,   `amount5` decimal(9,2) default null,   `amount6` decimal(9,2) default null,   `amount7` decimal(9,2) default null,   `amount8` decimal(9,2) default null,   `amount9` decimal(9,2) default null,   `amount10` decimal(9,2) default null,   `ttype` tinyint(4) default null,   `lineb` decimal(9,2) default null,   `lined` char(1) default null,   `linep` decimal(9,2) default null,   `linei` decimal(9,2) default null,   `linec` decimal(9,2) default null,   `linew` decimal(9,2) default null,   `liner` decimal(9,2) default null,   `linem` decimal(9,2) default null,   key `radate` (`adate`),   key `rttype` (`ttype`),   key `rticket` (`ticket`) ) engine=innodb default charset=latin1$$ 

my query:

select *   company1.rtable  ticket = 3478421; 

maybe there way change query use index? tried things 'and ticket > . . .' guess didn't help.

ticket char column , using number condition (3478421).


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -