Answer the question
In order to leave comments, you need to log in
What is the best way to speed up the selection with pagination?
I must say right away that I am not strong in the nuances, I know sql in general terms.
Now pagination is done as standard by remembering the last id. More or less like this:
SELECT *
FROM recording WHERE recording.id > 0 AND recording.artist_id = '269608'
ORDER BY recording.id
LIMIT 10
SELECT recording.id AS "recordingId", recording.name AS "trackName", artist.name AS "artistName"
FROM artist
INNER JOIN artist_credit_name ON artist.id = artist_credit_name.artist
INNER JOIN artist_credit ON artist_credit_name.artist_credit = artist_credit.id
INNER JOIN recording ON artist_credit.id = recording.artist_credit
WHERE artist.id = $(artistId) AND recording.id > $(index)
ORDER BY recording.id LIMIT $(limit)
Answer the question
In order to leave comments, you need to log in
The table contains 18 million records, but I don’t think that this is a very heavy scheme for subd (?)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question