الثلاثاء، 24 ديسمبر 2013

Optimising MySQL Database Indexes InnoDB

I have been Googleling for hours now and I haven't quite figured out how indexes work, because there are so many mixed answers available.

Let's say I have an query 1:

SELECT subid, subid2 FROM clicks WHERE wid=100 AND uid=123 AND time >= 1387886885

And a query 2:

SELECT subid, subid2 FROM clicks WHERE fid=100 AND time >= 1387886885 AND uid=123

1) How should I place indexes here? Should I use multi column index or single column indexes?

2) I found an answer on stackoverflow that suggested adding indexes to subid and subid2 also, should I do that?


View the original article here

ليست هناك تعليقات:

إرسال تعليق