S
S
slicephp2016-07-05 22:21:21
MySQL
slicephp, 2016-07-05 22:21:21

How do you speed up Limit in MySQL?

The bottom line is, there is a database of 1.5 million rows.
There is a SQL request, with pair JOIN. Now I'm doing pagination, like LIMIT offset,50, and so such a selection is performed for 3 seconds. No limit, casting is fast. So how to overcome this limit and speed up the selection with pagination? MySQL database

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tommy87, 2016-07-06
@tommy87

Get rid of the joins using denormalization, then the limit will work better, and in general it will be possible to build the corresponding index, in which your data will be pre-sorted. And in general, in order to better answer your question, I would like to see the structure and a more complete description of the task.

V
Vitaly, 2016-07-05
@vshvydky

speeding up the limit will not work, it is tied to count and the more lines, the longer it counts.
A simple option for a cycle is to do where id > xxx LIMIT 50 and then xxx+=50 and on a new one

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question