Answer the question
In order to leave comments, you need to log in
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.
Answer the question
In order to leave comments, you need to log in
CommonJS
module basics :
const task1 = () => {};
const task2 = () => {};
module.exports = {
task1,
task2,
}
const tasks = require('./tasks');
const { task1, task2 } = tasks;
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
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 questionAsk a Question
731 491 924 answers to any question