I'm working with MySQL Server version: 5.7.21.
I have a table with 2.804.806 rows, so it gets slow when I query through it without indexing.
I have a PRIMARY index on 'id' which is AUTO_INCREMENT
.
My next step was to do modify my query like this :
SELECT id, ut_date, servo_on, running_on, arc_on, robot_id FROM process__status_timers USE INDEX (id) WHERE id >934173 AND ut_date > 1546297200000 ORDER BY robot_id , id ASC
But still it was not using my key so I used FORCE INDEX
and finally i got :
But when I remove the EXPLAIN
I get a syntax error:
SELECT id, ut_date, servo_on, running_on, arc_on, robot_id FROM process__status_timers FORCE INDEX (PRIMARY) WHERE id >934173 AND ut_date > 1546297200000 ORDER BY robot_id , id ASC ;
Unrecognized keyword. (near
FORCE
)Unrecognized keyword.(near
INDEX
)Unexpected token (near ()
Unrecognized keyword.(near
PRIMARY
)Unexpected token (near ()
what I'm doing wrong ?
Thanks in advance