Tuesday, 15 September 2015

sql - MySql -Difference of Use Index vs Normal Select -



sql - MySql -Difference of Use Index vs Normal Select -

for illustration have employee table. has column id,name,address,age. have 2 kind of index.

indexname : idonly , fields: id indexname : idandname , fields: id,name

and first query normal select

select * employee id=1

and sec 1 phone call index name

select * employee utilize index(idonly) id=1

what difference of these two? there query time difference?

what difference of these two?

in sec you're hinting mysql utilize idonly index (it still may ignore it)

is there query time difference?

it's sec query in general case worse (in terms of performance; , worse in terms of maintainability), since optimizer (much) smarter you.

so rule of thumb "newer" utilize use index. may violate rule when know may violate it.

mysql sql

No comments:

Post a Comment