Tagged articles
50 articles
Page 1 of 1
Sohu Tech Products
Sohu Tech Products
Oct 9, 2025 · Databases

When to Use SELECT DISTINCT vs GROUP BY in MySQL: Performance & Use Cases

This article compares MySQL’s SELECT DISTINCT and GROUP BY clauses, explaining their syntax, functional differences, performance implications, and ideal scenarios through detailed examples, index usage analysis, and a feature comparison table, helping developers choose the right approach for deduplication or aggregation tasks.

GROUP BYSELECT DISTINCTSQL Performance
0 likes · 10 min read
When to Use SELECT DISTINCT vs GROUP BY in MySQL: Performance & Use Cases
Senior Brother's Insights
Senior Brother's Insights
Sep 27, 2025 · Databases

When to Use SELECT DISTINCT vs GROUP BY in MySQL: Features, Performance, and Examples

This article explains the functional differences, performance considerations, and practical use cases of MySQL's SELECT DISTINCT and GROUP BY clauses, providing syntax details, example tables, query results, and a comparison table to help developers choose the right approach for deduplication or aggregation tasks.

GROUP BYSELECT DISTINCTaggregation
0 likes · 8 min read
When to Use SELECT DISTINCT vs GROUP BY in MySQL: Features, Performance, and Examples
Su San Talks Tech
Su San Talks Tech
Sep 3, 2025 · Databases

Why Does MySQL GROUP BY Slow Down and How to Fix It

This article explains why a MySQL GROUP BY query can degrade from seconds to minutes as data grows, shows how to locate the bottlenecks with EXPLAIN and profiling tools, and provides practical indexing, query rewriting, temporary‑table tuning, batch aggregation, and distributed‑database strategies to restore performance.

GROUP BYindexingmysql
0 likes · 13 min read
Why Does MySQL GROUP BY Slow Down and How to Fix It
Tech Freedom Circle
Tech Freedom Circle
Sep 1, 2025 · Databases

How ClickHouse Executes GROUP BY and Handles Real‑Time Analytics on Billions of Rows

This article explains ClickHouse’s core architecture—including its storage‑compute integration, MPP parallelism, columnar storage, vectorized execution, data pre‑sorting, table engines, sparse and auxiliary indexes, and the two‑stage aggregation pipeline—then walks through the exact GROUP BY execution flow for both local and distributed tables, illustrating each step with diagrams, SQL demos, and code snippets.

Columnar StorageDistributed QueryGROUP BY
0 likes · 29 min read
How ClickHouse Executes GROUP BY and Handles Real‑Time Analytics on Billions of Rows
Java Tech Enthusiast
Java Tech Enthusiast
Jul 2, 2025 · Databases

Why MySQL GROUP BY Can Be Slow and How to Optimize It

This article explains why MySQL GROUP BY queries may run slowly, analyzes the execution plan showing temporary tables and filesort, and provides practical optimization techniques such as removing unnecessary sorting, adding indexes, adjusting buffer settings, and considering application‑level or materialized view solutions.

GROUP BYdatabasesindexing
0 likes · 4 min read
Why MySQL GROUP BY Can Be Slow and How to Optimize It
IT Services Circle
IT Services Circle
Jun 20, 2025 · Databases

Why MySQL GROUP BY Can Be Slow and How to Optimize It

This article explains why MySQL GROUP BY queries may run slowly due to missing indexes, temporary tables, and filesort, and provides practical optimization techniques such as removing unnecessary sorting, adding indexes, tuning buffers, and using application‑level or materialized view solutions.

GROUP BYindexingmysql
0 likes · 6 min read
Why MySQL GROUP BY Can Be Slow and How to Optimize It
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Oct 19, 2024 · Databases

Understanding the HAVING Clause in SQL: Concepts, Examples, and Best Practices

This article explains the purpose and proper use of the SQL HAVING clause, contrasts it with WHERE, and provides multiple practical examples—including counting groups, detecting missing IDs, calculating mode and median, and filtering fully‑submitted records—while highlighting common pitfalls and performance considerations.

GROUP BYHAVINGaggregation
0 likes · 13 min read
Understanding the HAVING Clause in SQL: Concepts, Examples, and Best Practices
Java Backend Technology
Java Backend Technology
Sep 11, 2024 · Databases

When to Use DISTINCT vs GROUP BY in MySQL: Performance Insights

This article compares MySQL's DISTINCT and GROUP BY clauses, detailing when they deliver identical performance with indexed columns, why DISTINCT can be faster without indexes, how each handles NULLs and multi‑column deduplication, and provides practical syntax examples and optimization guidance.

DISTINCTGROUP BYIndex Optimization
0 likes · 10 min read
When to Use DISTINCT vs GROUP BY in MySQL: Performance Insights
dbaplus Community
dbaplus Community
Aug 14, 2024 · Databases

When to Use DISTINCT vs GROUP BY in MySQL: Performance Insights

Both DISTINCT and GROUP BY can use indexes when available, giving similar performance, but without indexes DISTINCT is usually faster because GROUP BY may invoke implicit sorting; MySQL 8.0 removed this sorting, making their performance nearly equal, and GROUP BY offers clearer semantics and more flexibility for complex queries.

DISTINCTGROUP BYIndex Optimization
0 likes · 9 min read
When to Use DISTINCT vs GROUP BY in MySQL: Performance Insights
dbaplus Community
dbaplus Community
Dec 24, 2023 · Databases

Boost MySQL Performance: Proven SQL Optimization Techniques

When a system’s data grows, MySQL queries can become slow and cause latency; this article presents practical optimization strategies—including query tuning, pagination, join improvements, subquery replacement, order‑by and group‑by enhancements, and count() efficiency—illustrated with sample tables, code snippets, and performance screenshots.

GROUP BYJOINOrder By
0 likes · 13 min read
Boost MySQL Performance: Proven SQL Optimization Techniques
Liangxu Linux
Liangxu Linux
Aug 27, 2023 · Databases

Understanding the Real Execution Order of SQL Queries

This article explains the true execution sequence of SQL statements—starting with FROM and JOIN, then WHERE, GROUP BY, HAVING, SELECT, DISTINCT, ORDER BY, and LIMIT—illustrating each step with diagrams, examples, and code snippets to clarify how databases process queries.

FROMGROUP BYHAVING
0 likes · 6 min read
Understanding the Real Execution Order of SQL Queries
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
Laravel Tech Community
Laravel Tech Community
Feb 16, 2023 · Databases

DISTINCT vs GROUP BY in MySQL: Performance and Usage Guide

This article explains the differences between DISTINCT and GROUP BY in MySQL, showing that with an index they have similar efficiency, while without an index DISTINCT is usually faster because GROUP BY may trigger sorting and temporary tables, and it provides syntax, examples, and recommendations.

DISTINCTGROUP BYSQL Performance
0 likes · 8 min read
DISTINCT vs GROUP BY in MySQL: Performance and Usage Guide
Liangxu Linux
Liangxu Linux
Sep 13, 2022 · Databases

How to Find and Remove Duplicate Rows in SQL

This guide explains how to identify duplicate rows in a MySQL table using GROUP BY and HAVING, how to delete the extra rows while keeping the earliest entry, and how to handle duplicate detection across multiple columns with correct query patterns and common pitfalls.

DELETEGROUP BYHAVING
0 likes · 11 min read
How to Find and Remove Duplicate Rows in SQL
Su San Talks Tech
Su San Talks Tech
Apr 14, 2022 · Databases

How MySQL Uses Indexes for GROUP BY: Compact vs Loose Scans Explained

This article explains how MySQL can implement GROUP BY using either a compact index scan that reads rows sequentially or a loose index scan that jumps to the needed rows, compares their costs, and shows when each method is optimal, including a hybrid sequential‑loose scan.

GROUP BYcompact index scanloose index scan
0 likes · 15 min read
How MySQL Uses Indexes for GROUP BY: Compact vs Loose Scans Explained
Architecture & Thinking
Architecture & Thinking
Dec 27, 2021 · Databases

Master MySQL GROUP BY: From Basics to Advanced Aggregations

This guide explains MySQL GROUP BY syntax, the role of aggregate functions such as AVG, COUNT, MAX, MIN, and SUM, and demonstrates practical queries with single‑field and multi‑field grouping, filtering with WHERE and HAVING, ordering, limiting results, and the correct execution order of keywords.

Database QueriesGROUP BYSQL aggregation
0 likes · 12 min read
Master MySQL GROUP BY: From Basics to Advanced Aggregations
Liangxu Linux
Liangxu Linux
Aug 10, 2021 · Databases

How to Efficiently Remove Duplicate Rows in MySQL Tables

This guide explains step‑by‑step how to identify and delete duplicate records in MySQL tables, covering simple SELECT checks, handling MySQL’s update‑from limitation, and fast deletion techniques that keep one record per duplicate group.

DELETEGROUP BYduplicate removal
0 likes · 5 min read
How to Efficiently Remove Duplicate Rows in MySQL Tables
Aikesheng Open Source Community
Aikesheng Open Source Community
Jul 5, 2021 · Databases

Fetching the Latest Record per Name Group in MySQL 5.6/5.7

The article explains why a simple GROUP BY query in MySQL 5.6 returns the earliest rows instead of the most recent ones, demonstrates how to correctly obtain the latest record per name using sub‑queries or window functions, and discusses the impact of the ONLY_FULL_GROUP_BY mode in MySQL 5.7.

GROUP BYdatabasemysql
0 likes · 5 min read
Fetching the Latest Record per Name Group in MySQL 5.6/5.7
Selected Java Interview Questions
Selected Java Interview Questions
May 5, 2021 · Databases

Understanding MySQL Temporary Tables, MEM_ROOT Memory Management, and Query Optimization

This article explains how MySQL processes a GROUP BY query on a user view table, detailing the creation and use of memory and disk temporary tables, the MEM_ROOT allocation mechanism, the execution stages revealed by EXPLAIN, and how adding a composite index can eliminate temporary tables and filesort for better performance.

GROUP BYMemory Managementindex
0 likes · 13 min read
Understanding MySQL Temporary Tables, MEM_ROOT Memory Management, and Query Optimization
Programmer DD
Programmer DD
Apr 8, 2021 · Databases

Master SQL HAVING: Filter Groups Like a Pro

This article explains the purpose and proper use of the SQL HAVING clause, demonstrates how it works with GROUP BY to filter aggregated groups, shows examples for finding groups with specific counts, missing IDs, mode, median, and non‑NULL values, and clarifies best practices for query performance and semantics.

GROUP BYHAVINGaggregation
0 likes · 13 min read
Master SQL HAVING: Filter Groups Like a Pro
dbaplus Community
dbaplus Community
Mar 7, 2021 · Databases

Why Does MySQL GROUP BY Return Sorted Results? Uncovering Implicit Sorting

This article explains how MySQL versions prior to 8.0 automatically sorted GROUP BY results, why the optimizer added this hidden ordering, how the behavior was removed in MySQL 8.0, and what developers must watch for when migrating, illustrated with concrete SQL examples and EXPLAIN output.

GROUP BYimplicit sortingmigration
0 likes · 11 min read
Why Does MySQL GROUP BY Return Sorted Results? Uncovering Implicit Sorting
Programmer DD
Programmer DD
Oct 27, 2020 · Databases

How to Find and Delete Duplicate Records in MySQL Efficiently

This article explains how to identify duplicate rows in a MySQL table using GROUP BY and HAVING, shows several SELECT queries to list duplicates, and provides multiple DELETE strategies—including sub‑queries and multi‑column handling—to safely remove excess records while keeping one copy.

DELETEGROUP BYduplicate records
0 likes · 9 min read
How to Find and Delete Duplicate Records in MySQL Efficiently
Programmer DD
Programmer DD
Oct 12, 2020 · Databases

Mastering Set-Based SQL: From Relational Theory to Practical Queries

This article explains the relational model, its data structures, set-oriented operations, and integrity constraints, then demonstrates core SQL clauses such as SELECT, WHERE, GROUP BY, UNION, INTERSECT, EXCEPT, and various JOIN types with clear examples and diagrams.

GROUP BYJOINSet Theory
0 likes · 12 min read
Mastering Set-Based SQL: From Relational Theory to Practical Queries
Programmer DD
Programmer DD
Aug 18, 2020 · Databases

Why SELECT Columns After GROUP BY Are Restricted: MySQL Modes Explained

This article explains the SQL standard limits on SELECT columns after GROUP BY, demonstrates how MySQL's ONLY_FULL_GROUP_BY mode enforces those limits, explores various SQL modes, and clarifies why aggregated queries cannot reference non‑grouped columns directly.

GROUP BYONLY_FULL_GROUP_BYSQL Mode
0 likes · 11 min read
Why SELECT Columns After GROUP BY Are Restricted: MySQL Modes Explained
Aikesheng Open Source Community
Aikesheng Open Source Community
Aug 13, 2019 · Databases

Understanding MySQL GROUP BY Execution Strategies

This article explains why MySQL GROUP BY can dominate query cost, describes the four execution methods—index‑ordered, external‑sort (filesort), temporary‑table, and index‑skip‑scan for MIN/MAX—shows how filtering interacts with grouping, and offers practical tips such as using FORCE INDEX to obtain the optimal plan.

Database IndexesGROUP BYmysql
0 likes · 12 min read
Understanding MySQL GROUP BY Execution Strategies
Java Captain
Java Captain
Aug 7, 2019 · Databases

Practical Guide to Group, Join, and CASE WHEN Queries in SQL

This article provides a beginner‑friendly, step‑by‑step tutorial on common SQL operations—including GROUP BY aggregation, JOIN types, CASE WHEN expressions, and useful built‑in functions—illustrated with clear examples, typical pitfalls, and ready‑to‑use code snippets.

CASE WHENDatabase tutorialGROUP BY
0 likes · 10 min read
Practical Guide to Group, Join, and CASE WHEN Queries in SQL
Liangxu Linux
Liangxu Linux
Mar 17, 2019 · Databases

How to Find and Remove Duplicate Rows in SQL Tables

This guide explains how to define duplicate rows, use GROUP BY and HAVING to locate them, and apply temporary tables and DELETE statements to remove duplicates while preserving the row with the smallest ID.

DELETEGROUP BYHAVING
0 likes · 11 min read
How to Find and Remove Duplicate Rows in SQL Tables
MaGe Linux Operations
MaGe Linux Operations
Feb 28, 2019 · Databases

How to Find and Remove Duplicate Rows in MySQL

This article shows step‑by‑step how to identify duplicate rows in a MySQL table—whether the duplication is based on a single column, multiple columns, or either column—and provides reliable SQL patterns, including GROUP BY with HAVING, UNION, sub‑queries, temporary tables, and a safe DELETE statement to clean the data.

DELETEGROUP BYHAVING
0 likes · 11 min read
How to Find and Remove Duplicate Rows in MySQL
MaGe Linux Operations
MaGe Linux Operations
Apr 26, 2018 · Databases

Find Duplicate Rows in MySQL: Simple Queries for Beginners

This article shows how to identify and remove duplicate rows in a MySQL table by defining duplication, using GROUP BY with HAVING, creating temporary tables with MIN, and applying various techniques—including UNION, nested subqueries, and joins—to handle single‑column and multi‑column duplicate detection.

GROUP BYHAVINGdata cleaning
0 likes · 11 min read
Find Duplicate Rows in MySQL: Simple Queries for Beginners
ITPUB
ITPUB
Apr 3, 2016 · Databases

Master SQL GROUP BY: From Simple Aggregations to Rollup and Joins

This guide explains how to use SQL's GROUP BY clause with examples covering basic grouping, GROUP_CONCAT, aggregate functions, HAVING filters, multi‑column grouping, WITH ROLLUP, and inner, left, and right joins, illustrating each technique with clear query results.

GROUP BYHAVINGWITH ROLLUP
0 likes · 7 min read
Master SQL GROUP BY: From Simple Aggregations to Rollup and Joins
Java High-Performance Architecture
Java High-Performance Architecture
Jul 29, 2015 · Databases

How Indexes Enable Efficient GROUP BY Queries in MySQL

This article explains why GROUP BY requires sorting like ORDER BY, how a suitable index can satisfy both operations, and outlines the precise conditions—including single‑table queries, left‑most index prefixes, constant values, and limited aggregates—that allow MySQL to execute GROUP BY using an index scan.

GROUP BYIndex Optimizationmysql
0 likes · 3 min read
How Indexes Enable Efficient GROUP BY Queries in MySQL