P
P
player1_serg2015-05-15 11:58:33
JavaScript
player1_serg, 2015-05-15 11:58:33

Why doesn't LIMIT OFFSET optimization work?

There is a table with 500k+ records with two columns id and value. A normal query with LIMIT OFFSET scans all records up to the limit. I'm trying to do optimization with JOIN, like here habrahabr.ru/post/217521/. However, the same number of entries are viewed. The index on the id column is PRIMARY.8ca6632d40454c9bb736f89b382bfb06.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Spirin, 2018-06-10
@UnluckySerivelha

CommonJS module basics :

const task1 = () => {};
const task2 = () => {};

module.exports = {
  task1,
  task2,
}

const tasks = require('./tasks');

const { task1, task2 } = tasks;

M
myfirepukan, 2015-05-15
@myfirepukan

So, voice the query time, I then did LIMIT OFFSET on a table with a million records and everything was fine, but the time increased compared to the first one, but it seemed to fit in 0.1 seconds

A
AxisPod, 2015-05-15
@AxisPod

Patamushta sorting. Until it sorts, it will not be able to apply limit, in MyISAM it is clear that there are no clustered indexes. In InnoDB it is possible when sorting by clustered index will be able to. What is the table engine?
Well, yes, did you notice that in the article you indicated, there is no sorting for the external query? The nested query will require a temporary table, and sorting will also require it, so the optimization here is strange after all.
Well, the limit will naturally look from the beginning, and not from that position. what you asked. And even the imposition of an index rarely leads to a good result.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question