L
L
Lomoson2014-11-14 16:12:30
MySQL
Lomoson, 2014-11-14 16:12:30

How to optimize a simple select * from table query?

Have a request

select ot.* from `my_table` as ot where ot.field01='11' and ((ot.field02='22' and ot.field03='33') or ot.field04='44' or ot.field05='55') order by ot.field06 desc limit 0, 20

But it runs 0.02, but I want it to run 0.002.
Tell me, please, how can this be done? Indexes stand on each of the fields and set for the entire group.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2014-11-14
@Sanasol

describe/explain
indexes do not exist for this and are not composed in this way.
habrahabr.ru/post/70640

V
Vyacheslav Uspensky, 2014-11-14
@Kwisatz

First of all, forget what happens * this is bad practice
Show indexes on the table and preferably create_table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question