Snailclimb / JavaGuide

「Java学习+面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识。准备 Java 面试,首选 JavaGuide!
https://javaguide.cn
Apache License 2.0
147.1k stars 45.63k forks source link

Correct deep-pagination-optimization.md #2506

Closed whaliendev closed 1 month ago

whaliendev commented 1 month ago

In the section on deep pagination optimization recommendations, even with deferred joins and subqueries, the internal SQL statements will still result in deep pagination. These queries need to be rewritten to use the primary key index (id). Otherwise, there is no difference from the original SQL, and performance might even be worse.

whaliendev commented 1 month ago

Here are the evidence:

image for subquery

image for deferred join