klaasa klaasa - 1 year ago 56
SQL Question

PHP Mysql query gets extremely slow after adding another WHERE parameter

I have been googling for a while about this issue, but couldn't find a solution.
I have a

that is gathering information from a
and whenever I had this to the query:
"date = {$this->datum->format('Y-m-d')}"
it takes around 5 seconds to finish. When I don't use this
it is just taking a few milli seconds.

Anyone knows what is causing this

Answer Source

Try adding an index :

CREATE INDEX index_name
 ON table_name (`date`)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download