My database has two columns : time and work. Its very very large and still growing.
I want to select the last entry:
$sql = "SELECT time, work FROM device ORDER BY time DESC LIMIT 1"
It takes 1.5 seconds to response it. How can I speed this up?. Because I repeat it 20 times.
I can’t wait 20 seconds.
Greetings!
use
MAXadd also an
Indexon columntimeI was wondering why do you want to repeat this 20 times. If you are working on the application lebel, maybe you can add the result in a variable so you won’t execute it again.