Limit in mysql is timing out -


in nutshell, query returns 890738 entries

select *   `cms_question_report`   `doa` <  '2014-12-16 11:48:13'  

and in around 2 seconds

after trying cut 4 chunks, query times out , produces error

select *   `cms_question_report`   `doa` <  '2014-12-16 11:48:13' limit 222684 

here's error:

error in processing request error code: 500 error text: internal server error 

in basic understanding shouldn't second 1 run faster has lower limit data it's fetching?

another test:

select *   `cms_question_report`   `doa` <  '2014-12-16 11:48:13' limit 2 

that worked smoothly

no not run faster. db has first results , order them before applying limit. know seems waste of resource, why not stop after getting limit rows? because have ordered, when order implicit because have not specified explicit order. implicit order pk order of main table in query, clause means rows not automaticaly found in order. rows have found, ordered, limited.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -