starman@programming.dev to Programming@programming.devEnglish · edit-211 months agoWhy You Shouldn’t Use OFFSET and LIMIT For Your Paginationivopereira.netexternal-linkmessage-square8fedilinkarrow-up14arrow-down17file-text
arrow-up1-3arrow-down1external-linkWhy You Shouldn’t Use OFFSET and LIMIT For Your Paginationivopereira.netstarman@programming.dev to Programming@programming.devEnglish · edit-211 months agomessage-square8fedilinkfile-text
If you are wondering why lemmy is moving away from offset pagination since 0.19, here is a nice article about it
minus-squarelysdexic@programming.devlinkfedilinkEnglisharrow-up1·11 months agoFor the article-impaired, Using OFFSET+LIMIT for pagination forces a full table scan, which in large databases is expensive. The alternative proposed is a cursor+based navigation, which is ID+LIMIT and requires ID to be an orderable type with monotonically increasing value.
For the article-impaired,
Using OFFSET+LIMIT for pagination forces a full table scan, which in large databases is expensive.
The alternative proposed is a cursor+based navigation, which is ID+LIMIT and requires ID to be an orderable type with monotonically increasing value.