Tagged articles
6 articles
Page 1 of 1
dbaplus Community
dbaplus Community
Sep 22, 2022 · Databases

Why MySQL IN Subqueries Turn Into Slow Full Scans—and How to Fix Them

A large‑scale user‑push system suffers from minutes‑long MySQL queries because the IN subquery materializes a temporary table and triggers a semi‑join that forces full table scans, but disabling the semi‑join optimizer or rewriting the query restores sub‑second performance.

SQL OptimizationSemi-Joinexecution plan
0 likes · 8 min read
Why MySQL IN Subqueries Turn Into Slow Full Scans—and How to Fix Them
Java High-Performance Architecture
Java High-Performance Architecture
Aug 2, 2022 · Databases

Why MySQL IN Subqueries Can Be So Slow and How to Fix Them

This article examines why a MySQL query that uses an IN subquery on a massive users table becomes extremely slow, analyzes the execution plan revealing materialized temporary tables and semi‑join optimization, and demonstrates how disabling the optimizer or rewriting the query restores index usage and dramatically improves performance.

Semi-Joinexecution planindexing
0 likes · 8 min read
Why MySQL IN Subqueries Can Be So Slow and How to Fix Them
Architecture Digest
Architecture Digest
Jul 18, 2022 · Databases

Why MySQL IN Subquery with Semi‑Join Is Slow and How to Optimize It

The article analyzes a slow MySQL query that uses an IN subquery on a massive user table, explains how the optimizer’s semi‑join and materialized temporary tables cause full‑table scans, and demonstrates practical fixes such as disabling the semi‑join optimizer switch or rewriting the SQL to regain index usage.

SQL OptimizationSemi-Joinexecution plan
0 likes · 8 min read
Why MySQL IN Subquery with Semi‑Join Is Slow and How to Optimize It
Aikesheng Open Source Community
Aikesheng Open Source Community
Sep 21, 2020 · Databases

Understanding Semi‑join Materialization in MySQL Subquery Optimization

This article explains how MySQL transforms eligible subqueries into semi‑joins, describes the four semi‑join strategies, and details the Semi‑join Materialization approach—including Materialization‑scan and Materialization‑lookup—while showing how to identify the chosen strategy via EXPLAIN output.

Database PerformanceMaterializationSemi-Join
0 likes · 9 min read
Understanding Semi‑join Materialization in MySQL Subquery Optimization