Tagged articles
75 articles
Page 1 of 1
macrozheng
macrozheng
Dec 8, 2025 · Databases

Why LIMIT Pagination Slows Down on Large Tables and How to Optimize It

This tutorial demonstrates how MySQL LIMIT pagination performs on tables with millions of rows, measures query times for various offsets and batch sizes, and presents practical optimization techniques such as sub‑queries, ID‑range filtering, and column selection to improve speed.

LIMITlarge datasetsmysql
0 likes · 9 min read
Why LIMIT Pagination Slows Down on Large Tables and How to Optimize It
Java Tech Enthusiast
Java Tech Enthusiast
Mar 23, 2025 · Databases

MySQL Query Optimization Techniques: LIMIT, Implicit Conversion, Joins and More

The article shows how common MySQL performance pitfalls—such as large LIMIT offsets, implicit type conversions, sub‑query‑based updates or deletes, mixed ORDER BY, EXISTS clauses, and misplaced predicates—can be rewritten into index‑friendly forms using filters, joins, early limits, UNION ALL, and CTEs to achieve execution times that drop from seconds to milliseconds.

JOINLIMITSQL Optimization
0 likes · 14 min read
MySQL Query Optimization Techniques: LIMIT, Implicit Conversion, Joins and More
Architecture Digest
Architecture Digest
Nov 9, 2024 · Databases

MySQL Query Optimization Techniques and Common Pitfalls

This article examines frequent MySQL performance problems such as inefficient LIMIT pagination, implicit type conversion, sub‑query updates, mixed sorting, misuse of EXISTS, condition push‑down limitations, early result narrowing, intermediate result push‑down, and demonstrates how rewriting queries with JOINs, derived tables, and WITH clauses can dramatically improve execution speed.

JOINLIMITSQL Optimization
0 likes · 11 min read
MySQL Query Optimization Techniques and Common Pitfalls
Java Interview Crash Guide
Java Interview Crash Guide
Jul 24, 2024 · Databases

How to Supercharge MySQL Queries: 8 Proven Optimization Techniques

Learn eight practical MySQL optimization strategies—including smarter LIMIT usage, avoiding implicit type conversion, rewriting subqueries with JOINs, handling mixed sorting, eliminating costly EXISTS clauses, pushing conditions, pre‑filtering data, and leveraging intermediate result sets—to dramatically reduce query execution time from seconds to milliseconds.

LIMITSQL PerformanceWITH clause
0 likes · 15 min read
How to Supercharge MySQL Queries: 8 Proven Optimization Techniques
dbaplus Community
dbaplus Community
Jul 9, 2024 · Databases

Why MySQL LIMIT Can Kill Performance and How to Fix It

This article explains how the LIMIT clause can cause massive I/O and CPU overhead in MySQL queries, analyzes the underlying B+‑tree index structure and execution plans, and presents practical optimization techniques such as covering indexes, sub‑queries, and partitioning.

LIMITmysqlperformance
0 likes · 9 min read
Why MySQL LIMIT Can Kill Performance and How to Fix It
Top Architect
Top Architect
Apr 19, 2024 · Databases

Problems with OFFSET/LIMIT Pagination and Cursor‑Based Alternatives

This article explains why using OFFSET and LIMIT for pagination becomes inefficient on large tables, illustrates the performance impact with examples, and proposes a cursor‑based pagination alternative that leverages indexed primary keys to achieve faster, scalable queries.

CursorLIMITOFFSET
0 likes · 8 min read
Problems with OFFSET/LIMIT Pagination and Cursor‑Based Alternatives
Su San Talks Tech
Su San Talks Tech
Nov 26, 2023 · Databases

Why Does MySQL LIMIT offset,size Slow Down With Large Offsets?

This article explains why MySQL's LIMIT offset,size becomes slower as the offset grows, compares it with LIMIT size, details the internal execution using primary and secondary indexes, discusses deep pagination issues, and presents practical optimization techniques to improve query performance.

LIMITdeep paginationmysql
0 likes · 14 min read
Why Does MySQL LIMIT offset,size Slow Down With Large Offsets?
JD Retail Technology
JD Retail Technology
Oct 20, 2023 · Databases

Understanding Pagination Issues with ORDER BY and LIMIT in MySQL

This article examines why combining ORDER BY with LIMIT in MySQL pagination can produce duplicate rows on subsequent pages, analyzes the optimizer’s priority‑queue behavior introduced in version 5.6, and presents practical solutions such as using unique sort keys, adding ID ordering, and understanding deep‑pagination limitations.

LIMITOrder Bymysql
0 likes · 8 min read
Understanding Pagination Issues with ORDER BY and LIMIT in MySQL
Architecture Digest
Architecture Digest
Feb 22, 2023 · Databases

Understanding the Execution Order of SQL Queries

This article explains the logical execution sequence of a typical SQL query, detailing each phase from FROM/JOIN/WHERE through GROUP BY, HAVING, SELECT, ORDER BY, and LIMIT, and illustrating the process with diagrams and code examples.

From Join WhereGROUP BYHAVING
0 likes · 8 min read
Understanding the Execution Order of SQL Queries
Java Architect Essentials
Java Architect Essentials
Feb 19, 2023 · Databases

Understanding the Execution Order of SQL Queries

This article explains the step‑by‑step execution order of a standard SQL query, covering FROM/JOIN, WHERE, GROUP BY, HAVING, SELECT, DISTINCT, ORDER BY and LIMIT, and provides illustrative code snippets and diagrams to clarify each stage.

FROMGROUP BYHAVING
0 likes · 5 min read
Understanding the Execution Order of SQL Queries
Java Architect Essentials
Java Architect Essentials
Jan 30, 2023 · Databases

Boost MySQL Performance: 9 Proven Query Optimization Techniques

This article presents nine practical MySQL optimization methods—including smarter LIMIT usage, avoiding implicit type conversion, rewriting subqueries as joins, handling mixed sorting, replacing EXISTS with joins, pushing conditions into subqueries, early range reduction, and using CTEs—to dramatically improve query execution time across common scenarios.

CTEDatabase IndexesJOIN
0 likes · 14 min read
Boost MySQL Performance: 9 Proven Query Optimization Techniques
Laravel Tech Community
Laravel Tech Community
Jan 2, 2023 · Databases

Advanced MySQL Query Optimization Techniques: LIMIT, Implicit Conversion, Join Rewrite, and More

This article presents a series of practical MySQL performance‑tuning methods—including smarter LIMIT usage, handling implicit type conversion, rewriting UPDATE/DELETE with JOIN, mixed‑order optimization, EXISTS replacement, condition push‑down, early result filtering, and CTE usage—to dramatically reduce query execution time across common scenarios.

CTEJOINLIMIT
0 likes · 13 min read
Advanced MySQL Query Optimization Techniques: LIMIT, Implicit Conversion, Join Rewrite, and More
Su San Talks Tech
Su San Talks Tech
Aug 13, 2022 · Databases

Why MySQL LIMIT offset slows down deep pagination and how to fix it

This article explains how MySQL processes LIMIT with an offset, why large offsets cause slower queries and deep‑pagination problems, and presents practical optimization techniques such as id‑based pagination, sub‑queries, and index‑aware strategies to improve performance.

LIMITdeep paginationmysql
0 likes · 14 min read
Why MySQL LIMIT offset slows down deep pagination and how to fix it
dbaplus Community
dbaplus Community
Jul 4, 2022 · Databases

Why Large‑Offset LIMIT Is Slow in MySQL and How to Speed It Up

The article explains why a MySQL query with a large LIMIT offset becomes extremely slow, demonstrates the underlying I/O behavior, and shows how rewriting the query with a sub‑query that fetches primary keys first can cut execution time from seconds to milliseconds while also reducing buffer‑pool pollution.

InnoDBLIMITSubquery
0 likes · 9 min read
Why Large‑Offset LIMIT Is Slow in MySQL and How to Speed It Up
Top Architect
Top Architect
Mar 5, 2022 · Databases

Why MySQL LIMIT with Large Offsets Is Slow and How to Optimize It

The article demonstrates that MySQL queries using LIMIT with a large offset cause heavy random I/O by scanning many rows, and shows how rewriting the query with a sub‑query that selects only primary keys dramatically reduces execution time from seconds to milliseconds.

LIMITbuffer poolmysql
0 likes · 8 min read
Why MySQL LIMIT with Large Offsets Is Slow and How to Optimize It
Java Architect Essentials
Java Architect Essentials
Feb 24, 2022 · Databases

Why LIMIT Slows MySQL Queries and How to Speed Them Up

This article analyzes why a MySQL query with a large LIMIT offset can take seconds to run, demonstrates the underlying index and buffer‑pool behavior, and shows how rewriting the query with a sub‑select of primary keys reduces execution time from over 16 seconds to under half a second.

LIMITbuffer poolindex
0 likes · 9 min read
Why LIMIT Slows MySQL Queries and How to Speed Them Up
Java Architect Essentials
Java Architect Essentials
Dec 14, 2021 · Databases

Why LIMIT Can Slow Down MySQL Queries and How to Fix It

Using LIMIT with a large offset in MySQL can cause severe performance degradation due to excessive random I/O, but by rewriting the query to first fetch primary keys in a subquery and then joining, execution time can drop from seconds to milliseconds, as demonstrated with real data.

InnoDBLIMITbuffer pool
0 likes · 10 min read
Why LIMIT Can Slow Down MySQL Queries and How to Fix It
Senior Brother's Insights
Senior Brother's Insights
Oct 28, 2021 · Databases

Why MySQL LIMIT Can Return Duplicate Rows and How to Fix It

In a production environment, a pagination export feature caused duplicate and missing records due to MySQL’s nondeterministic ordering when multiple rows share the same ORDER BY value, and the article explains the root cause, official documentation, and a reliable solution using additional sorting columns.

LIMITOrder Byduplicate rows
0 likes · 10 min read
Why MySQL LIMIT Can Return Duplicate Rows and How to Fix It
Xiao Lou's Tech Notes
Xiao Lou's Tech Notes
Oct 12, 2021 · Databases

Optimizing ORDER BY/LIMIT in Sharded Databases with Cobar’s Algorithm

This article explains Cobar’s sharding middleware and presents an optimization technique for handling ORDER BY and LIMIT queries across multiple databases, detailing the original approach, its inefficiencies with deep pagination, the step‑by‑step improved algorithm, performance analysis, limitations, and practical applicability.

CobarLIMITOrder By
0 likes · 8 min read
Optimizing ORDER BY/LIMIT in Sharded Databases with Cobar’s Algorithm
Top Architect
Top Architect
Sep 21, 2021 · Databases

Understanding MySQL LIMIT OFFSET Performance and Buffer‑Pool Impact

The article demonstrates how a large OFFSET in a MySQL LIMIT query forces MySQL to scan millions of index rows and data pages, causing severe slowdown, and shows that rewriting the query with an inner‑join sub‑select dramatically reduces I/O and buffer‑pool usage, confirming the performance difference through experiments.

InnoDBLIMITOFFSET
0 likes · 8 min read
Understanding MySQL LIMIT OFFSET Performance and Buffer‑Pool Impact
Top Architect
Top Architect
Sep 10, 2021 · Databases

Optimizing MySQL LIMIT Queries by Reducing Unnecessary Row Scans

This article explains why using a large OFFSET with MySQL LIMIT can cause severe performance degradation, demonstrates the problem with a real‑world 9.5 million‑row table, and shows how rewriting the query with a sub‑query that selects only primary keys can cut execution time from seconds to milliseconds.

InnoDBLIMITSQL Optimization
0 likes · 8 min read
Optimizing MySQL LIMIT Queries by Reducing Unnecessary Row Scans
ITPUB
ITPUB
Aug 19, 2021 · Databases

Why Does MySQL LIMIT with ORDER BY Return Duplicate Rows on Page 2?

When using MySQL pagination with LIMIT together with ORDER BY, the second page can unexpectedly contain rows from the first page because MySQL 5.6's priority‑queue optimization performs an unstable heap sort, causing nondeterministic ordering for equal values and leading to duplicate results.

LIMITOrder Bydatabase
0 likes · 7 min read
Why Does MySQL LIMIT with ORDER BY Return Duplicate Rows on Page 2?
ITPUB
ITPUB
Aug 13, 2021 · Databases

Why LIMIT with Large OFFSET Slows MySQL and How to Speed It Up

When a MySQL query uses LIMIT with a large offset on a table of millions of rows, the database must scan hundreds of thousands of index entries and corresponding clustered rows, causing massive random I/O; rewriting the query with a sub‑query join reduces I/O dramatically, cutting execution time from over a minute to under a second while also preventing buffer‑pool pollution.

InnoDBLIMITbuffer pool
0 likes · 9 min read
Why LIMIT with Large OFFSET Slows MySQL and How to Speed It Up
Code Ape Tech Column
Code Ape Tech Column
May 11, 2021 · Databases

How to Speed Up MySQL LIMIT Pagination for Millions of Rows

This article analyzes six MySQL pagination techniques, presents benchmark results showing how query time grows with offset, and offers practical index‑based optimizations—including covering indexes, subqueries, and composite index design—to make LIMIT pagination fast even on very large tables.

LIMITindexmysql
0 likes · 12 min read
How to Speed Up MySQL LIMIT Pagination for Millions of Rows
Architecture Digest
Architecture Digest
May 9, 2021 · Databases

Optimizing MySQL Pagination with LIMIT: Methods, Experiments, and Index Strategies

This article examines the performance drawbacks of MySQL's LIMIT pagination on large tables, presents six practical query methods—including direct LIMIT, primary‑key indexing, index‑based ordering, prepared statements, covering indexes, and sub‑query/join techniques—provides extensive benchmark results, and offers concrete indexing recommendations to achieve fast, stable pagination even with millions of rows.

LIMITLarge Dataindexing
0 likes · 12 min read
Optimizing MySQL Pagination with LIMIT: Methods, Experiments, and Index Strategies
Code Ape Tech Column
Code Ape Tech Column
Jan 26, 2021 · Databases

Why Adding LIMIT to MySQL DELETE Is a Must‑Have Safety Habit

The article explains why appending LIMIT to MySQL DELETE statements improves performance, reduces lock contention, and safeguards data by limiting rows affected, provides syntax details, compares deletion strategies for removing large numbers of rows, and offers practical recommendations for safe and efficient data removal.

DELETEData SafetyDatabase Performance
0 likes · 8 min read
Why Adding LIMIT to MySQL DELETE Is a Must‑Have Safety Habit
MaGe Linux Operations
MaGe Linux Operations
Jan 15, 2021 · Databases

Why ORDER BY with LIMIT Returns Unexpected Row Order in MySQL

When you combine ORDER BY with LIMIT in MySQL, the result set may appear in a different order than expected, especially if the ordered column contains duplicate values, and understanding the optimizer's behavior and adding deterministic columns can resolve this issue.

LIMITOrder Bydatabase
0 likes · 6 min read
Why ORDER BY with LIMIT Returns Unexpected Row Order in MySQL
Architect
Architect
Oct 24, 2020 · Databases

Why Adding LIMIT to DELETE Statements Is a Good Practice in MySQL

The article explains that using LIMIT with DELETE in MySQL improves safety, reduces lock time, prevents long‑running transactions, and enhances performance, and it provides syntax, examples, and expert opinions to illustrate the benefits of this habit.

DELETEDatabase PerformanceLIMIT
0 likes · 7 min read
Why Adding LIMIT to DELETE Statements Is a Good Practice in MySQL
Programmer DD
Programmer DD
Sep 19, 2020 · Databases

Boost MySQL Pagination Performance: Proven Techniques and Benchmarks

This article examines various MySQL pagination strategies—including simple LIMIT clauses, sub‑query optimizations, ID‑range queries, and temporary‑table methods—by testing them on a table with millions of rows and presenting detailed timing results that reveal significant speed improvements.

LIMITPerformance Testingmysql
0 likes · 9 min read
Boost MySQL Pagination Performance: Proven Techniques and Benchmarks
Selected Java Interview Questions
Selected Java Interview Questions
Jun 5, 2020 · Databases

MySQL Query Optimization Techniques and Common Pitfalls

This article explains MySQL execution order, highlights performance problems with large OFFSET LIMIT queries, demonstrates how implicit type conversion, sub‑query rewriting, EXISTS removal, condition push‑down, and intermediate result push‑down can dramatically improve query speed, and provides practical SQL rewrite examples.

JOINLIMITSQL Optimization
0 likes · 13 min read
MySQL Query Optimization Techniques and Common Pitfalls
Top Architect
Top Architect
Apr 30, 2020 · Databases

Why LIMIT with Large Offsets Slows MySQL Queries and How to Optimize It

The article explains why using LIMIT with a large offset in MySQL causes severe performance degradation, demonstrates the problem with real data, and shows how rewriting the query with a sub‑query that selects only primary keys dramatically reduces execution time by avoiding massive random I/O and buffer‑pool pollution.

LIMITbuffer poolindex
0 likes · 8 min read
Why LIMIT with Large Offsets Slows MySQL Queries and How to Optimize It
Java Backend Technology
Java Backend Technology
Apr 23, 2020 · Databases

Why MySQL LIMIT Can Reverse ORDER BY in LEFT JOIN Queries

The author discovers a puzzling MySQL bug where moving the LIMIT clause outside a nested SELECT causes the final result set to be ordered incorrectly, explains how ORDER BY inside subqueries is ignored during LEFT JOIN processing, and recommends placing ORDER BY and LIMIT at the outermost query level.

JOINLIMITOrder By
0 likes · 5 min read
Why MySQL LIMIT Can Reverse ORDER BY in LEFT JOIN Queries
Java Captain
Java Captain
Apr 5, 2020 · Databases

Optimizing MySQL LIMIT Queries by Reducing Row Lookups

This article explains why large OFFSET values in MySQL LIMIT queries cause severe performance degradation and demonstrates how rewriting the query to fetch primary keys first and then joining reduces execution time from seconds to milliseconds, supported by buffer‑pool analysis and practical test results.

LIMITbuffer poolindex
0 likes · 8 min read
Optimizing MySQL LIMIT Queries by Reducing Row Lookups
Java Backend Technology
Java Backend Technology
Jan 26, 2020 · Databases

Why LIMIT with Large Offsets Slows MySQL Queries and How to Fix It

The article explains how using LIMIT with a large offset on a MySQL table forces the engine to scan hundreds of thousands of index rows and cluster‑index pages, dramatically increasing I/O, and shows a sub‑query join technique that reduces the scan to just the needed rows, cutting execution time from minutes to fractions of a second while also illustrating the impact on the InnoDB buffer pool.

LIMITmysqlperformance
0 likes · 10 min read
Why LIMIT with Large Offsets Slows MySQL Queries and How to Fix It
ITPUB
ITPUB
Dec 30, 2019 · Databases

8 Proven MySQL Tricks to Supercharge Your Queries

This article presents eight practical MySQL optimization techniques—including smarter LIMIT usage, implicit type conversion fixes, join rewrites, mixed sorting, EXISTS elimination, condition pushdown, early row limiting, and intermediate result pushdown—each illustrated with SQL examples and performance comparisons that reduce query times from seconds to milliseconds.

EXISTSJOINLIMIT
0 likes · 13 min read
8 Proven MySQL Tricks to Supercharge Your Queries
Liangxu Linux
Liangxu Linux
Dec 23, 2019 · Databases

Boost MySQL Performance: Practical Tips for LIMIT, Implicit Conversion, Joins, and More

This article presents concrete MySQL optimization techniques—including smarter LIMIT usage, avoiding implicit type conversion, rewriting updates and deletes with JOINs, handling mixed ordering, replacing EXISTS with joins, pushing down conditions, and leveraging WITH clauses—to dramatically reduce query execution times from seconds to milliseconds.

EXISTSJOINLIMIT
0 likes · 14 min read
Boost MySQL Performance: Practical Tips for LIMIT, Implicit Conversion, Joins, and More
Java Backend Technology
Java Backend Technology
Dec 1, 2019 · Databases

Why Large LIMIT Offsets Slow MySQL Queries and How to Fix Them

This article explains how using a large OFFSET in a MySQL LIMIT clause forces the server to scan hundreds of thousands of index and data pages, causing massive random I/O, and demonstrates a faster rewrite with an inner join that dramatically reduces buffer‑pool usage and execution time.

InnoDBLIMITbuffer pool
0 likes · 7 min read
Why Large LIMIT Offsets Slow MySQL Queries and How to Fix Them
Programmer DD
Programmer DD
Nov 23, 2019 · Backend Development

Master Java Stream skip() and limit(): When and How to Trim Your Data

This article explains the Java 8 Stream API's skip() and limit() intermediate operations, showing how they truncate streams, handling of edge cases, code examples, and key differences to help developers choose the right method for their data processing needs.

BackendJava 8LIMIT
0 likes · 4 min read
Master Java Stream skip() and limit(): When and How to Trim Your Data
ITPUB
ITPUB
Jun 18, 2019 · Databases

Why MySQL LIMIT Pagination Slows Down and 6 Proven Optimization Techniques

This article examines why MySQL LIMIT pagination becomes slower as the offset grows, presents six practical methods—including direct LIMIT, primary‑key indexing, ordered index scans, prepared statements, sub‑queries, and joins—provides benchmark results on large tables, and distills actionable guidelines for designing covering and composite indexes to achieve fast, stable pagination.

Index OptimizationLIMITmysql
0 likes · 12 min read
Why MySQL LIMIT Pagination Slows Down and 6 Proven Optimization Techniques