Making quick queries [closed]

-2

How can I make queries faster on a MySQL table with 3 million records, the table has only 4 columns, and it takes me almost 5 seconds to return data. The fields I'm searching for have index . The Query returns close to 50,000 records and is executed by MySQL WorkBench . I leave some more information below and if necessary I can provide more information.

Query:

SELECT campo2, campo3, campo4 FROM tabela2 
WHERE campo2=25 AND campo3>='2016-09-01 00:00' AND campo3<='2016-10-01 00:00'

Table2 Structure:

id     - bigint
campo2 - int         - index
campo3 - timestamp   - index
campo4 - float

Can anyone help me with anything?

    
asked by anonymous 28.10.2016 / 11:19

1 answer

1

I do not see how to optimize your database query much better, it's a simple query with an appropriate index. But either take a look at the execution plan to confirm.

Assuming the query has been executed directly in the DB, the only other bottleneck I can imagine (besides some obscure configuration that has been made) is the hardware.

    
01.11.2016 / 12:46