Tag

subquery

0 views collected around this technical thread.

Aikesheng Open Source Community
Aikesheng Open Source Community
Jul 4, 2024 · Databases

MySQL Query Optimization: Reducing Joins and Subqueries to Boost Performance

This article analyzes a MySQL query that originally took nine seconds, identifies redundant joins and an EXISTS subquery on the same table, and demonstrates how restructuring the query eliminates duplicate scans, reducing execution time to 0.2 seconds.

JoinPerformanceSQL Optimization
0 likes · 7 min read
MySQL Query Optimization: Reducing Joins and Subqueries to Boost Performance
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Aug 23, 2023 · Databases

Deleting Duplicate Records in MySQL with DELETE JOIN and Subqueries

This article explains how to identify and remove duplicate rows in a MySQL table—keeping a single record per duplicate group—by using a self‑join DELETE statement or a nested subquery approach, complete with sample table creation and data insertion scripts.

DELETE JOINDatabaseDuplicate Records
0 likes · 6 min read
Deleting Duplicate Records in MySQL with DELETE JOIN and Subqueries
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Aug 21, 2023 · Databases

MySQL Join Update Techniques for Synchronizing Related Tables

This article explains how to perform relational updates in MySQL using JOINs, subqueries, and multi‑table UPDATE statements, demonstrating table creation, sample data insertion, and the differences between INNER, LEFT, and RIGHT joins for keeping dependent tables in sync.

DatabaseJoinSQL
0 likes · 7 min read
MySQL Join Update Techniques for Synchronizing Related Tables
Aikesheng Open Source Community
Aikesheng Open Source Community
Dec 27, 2022 · Databases

Understanding How MySQL Converts Uncorrelated Subqueries to Correlated Subqueries and Their Execution Plans

This article explains the process by which MySQL transforms uncorrelated IN subqueries into correlated subqueries, details the differences in EXPLAIN output columns, explores optimizer trace information, compares materialization versus correlated execution costs, and provides best‑practice recommendations for writing efficient queries.

Database PerformanceEXPLAINQuery Optimization
0 likes · 15 min read
Understanding How MySQL Converts Uncorrelated Subqueries to Correlated Subqueries and Their Execution Plans
Top Architect
Top Architect
Jan 22, 2022 · Databases

Optimizing MySQL Pagination Queries with Subqueries and Buffer‑Pool Analysis

The article explains why large‑offset LIMIT queries on a MySQL table with millions of rows are slow, demonstrates how rewriting the query to use a subquery that first selects primary‑key IDs dramatically reduces execution time, and validates the improvement by measuring buffer‑pool page usage.

Database PerformanceQuery Optimizationbuffer pool
0 likes · 9 min read
Optimizing MySQL Pagination Queries with Subqueries and Buffer‑Pool Analysis
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Sep 30, 2021 · Databases

Why DELETE IN Subqueries Skip Indexes in MySQL and How to Optimize Them

This article investigates why a DELETE IN subquery in MySQL 5.7 performs a full table scan instead of using an index, explains the optimizer’s behavior compared to SELECT IN, and provides practical solutions such as rewriting the statement as a JOIN or adding table aliases to enable index usage.

DELETEIndexJoin
0 likes · 6 min read
Why DELETE IN Subqueries Skip Indexes in MySQL and How to Optimize Them
Python Programming Learning Circle
Python Programming Learning Circle
Jun 22, 2021 · Databases

Decorrelation of Correlated Subqueries: Theory, Operators, and Optimization Rules

This article explains why correlated subqueries are a performance bottleneck, introduces the Apply (Correlated Join) operator, classifies subquery types, shows how to transform them into efficient joins, and discusses rule‑based push‑down techniques for Project, Filter, Aggregate, and Set operations.

Apply OperatorDatabaseDecorrelation
0 likes · 15 min read
Decorrelation of Correlated Subqueries: Theory, Operators, and Optimization Rules
Architect
Architect
Dec 10, 2020 · Databases

Optimizing MySQL LIMIT Offset Queries with Subqueries to Reduce Table Scans

This article demonstrates how to dramatically improve MySQL LIMIT offset query performance by moving the filter into a subquery that selects only primary keys, then joining to retrieve full rows, and validates the approach with buffer pool statistics and execution time measurements.

Limit OffsetQuery Optimizationbuffer pool
0 likes · 9 min read
Optimizing MySQL LIMIT Offset Queries with Subqueries to Reduce Table Scans
Aikesheng Open Source Community
Aikesheng Open Source Community
Nov 20, 2020 · Databases

Optimizing a Slow MySQL 5.7 Query for Detecting Tables Without Primary or Unique Keys

This article examines why a MySQL 5.7 query that finds tables lacking primary or unique keys runs extremely slowly, demonstrates an experiment reproducing the issue, analyzes the optimizer's subquery rewrite, and shows how adding hints and materialization reduces execution time from over 16 seconds to under one second.

INFORMATION_SCHEMAPerformanceQuery Optimization
0 likes · 4 min read
Optimizing a Slow MySQL 5.7 Query for Detecting Tables Without Primary or Unique Keys
Aikesheng Open Source Community
Aikesheng Open Source Community
Jun 28, 2020 · Databases

MySQL Subquery Optimization Strategies and Rewriting DELETE with JOIN

This article explains why a DELETE statement with a sub‑query can cause a full‑table scan in MySQL, describes the optimizer's semijoin, materialization and exists strategies for different sub‑query types, and shows how to rewrite the statement using a JOIN for better performance.

DELETEJoinMaterialization
0 likes · 9 min read
MySQL Subquery Optimization Strategies and Rewriting DELETE with JOIN
Efficient Ops
Efficient Ops
Aug 27, 2019 · Databases

Why MySQL Scans the Whole Table Before a Subquery? A Deep Dive into Slow Queries

This article investigates a MySQL slow query caused by a subquery that triggers a full‑table scan, explains MySQL's query rewrite behavior, and shows how Django's lazy ORM evaluation can worsen performance, offering practical fixes using explicit query execution or join rewrites.

Database PerformanceDjango ORMQuery Optimization
0 likes · 8 min read
Why MySQL Scans the Whole Table Before a Subquery? A Deep Dive into Slow Queries
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
Apr 11, 2017 · Databases

Why a Simple MySQL IN Subquery Takes 33 Seconds and How to Fix It

This article examines why a seemingly simple MySQL IN subquery on tens of thousands of rows can take 33 seconds, explains the optimizer’s behavior in MySQL 5.5, and presents practical fixes such as using temporary tables or JOINs to dramatically improve performance.

IN clauseJoinPerformance
0 likes · 5 min read
Why a Simple MySQL IN Subquery Takes 33 Seconds and How to Fix It