Tagged articles

Filesort

9 articles · Page 1 of 1
samdeepthink
samdeepthink
Aug 4, 2026 · Databases

Choosing the Best Composite Index for A = ?, B IN (...), ORDER BY C

The article explains why placing column C immediately after the equality column A in a composite index (A, C, B) avoids filesort and keeps performance stable regardless of how many values appear in the B IN list, outperforming other index orders such as (A, B, C).

Composite IndexFilesortIN Clause
0 likes · 10 min read
Choosing the Best Composite Index for A = ?, B IN (...), ORDER BY C
Top Architect
Top Architect
Nov 29, 2025 · Databases

Should You Disable MySQL’s prefer_ordering_index? A Practical Performance Guide

This article examines MySQL’s optimizer_switch ‘prefer_ordering_index’ setting, explains how it influences ORDER BY/GROUP BY queries with LIMIT, demonstrates cases where keeping it ON harms performance due to costly index scans, and provides concrete SQL examples and recommendations to turn it off in most scenarios.

FilesortIndex ScanMySQL
0 likes · 8 min read
Should You Disable MySQL’s prefer_ordering_index? A Practical Performance Guide
dbaplus Community
dbaplus Community
Oct 30, 2025 · Databases

When Should You Turn Off MySQL’s prefer_ordering_index? A Deep Dive

This article explains the purpose of MySQL's optimizer_switch prefer_ordering_index, why the default ON can hurt performance on skewed data, and demonstrates with table creation, data‑loading procedures, and EXPLAIN output how turning the option OFF often yields faster queries.

FilesortIndex ScanMySQL
0 likes · 7 min read
When Should You Turn Off MySQL’s prefer_ordering_index? A Deep Dive
ITPUB
ITPUB
Feb 21, 2023 · Databases

How MySQL Implements File Sorting: Internals, Modes, and Optimizations

This article explains MySQL's file‑sort mechanism in depth, covering the sort buffer, handling of long sort keys, three sort modes, priority‑queue and read‑rnd‑buffer optimizations, internal vs. external sorting, descending sort implementation, and how to inspect details with optimizer trace.

FilesortMySQLexternal sorting
0 likes · 32 min read
How MySQL Implements File Sorting: Internals, Modes, and Optimizations