Tag

count()

1 views collected around this technical thread.

macrozheng
macrozheng
Apr 11, 2025 · Databases

Why MySQL count() Slows Down on Large Tables and How to Speed It Up

This article explains how MySQL's count() works across storage engines, why InnoDB scans rows and can time out on massive tables, and presents practical alternatives such as using EXPLAIN rows, a dedicated count table, batch processing, or binlog‑to‑Hive for efficient row‑count estimation.

InnoDBMonitoringMyISAM
0 likes · 14 min read
Why MySQL count() Slows Down on Large Tables and How to Speed It Up
IT Services Circle
IT Services Circle
Feb 2, 2025 · Databases

Performance Comparison of MySQL COUNT Queries on InnoDB and MyISAM

This article experimentally compares the performance of various MySQL COUNT queries on an InnoDB table with one million rows, explains the underlying execution plans using EXPLAIN, analyzes primary‑key versus secondary‑index behavior, and contrasts InnoDB’s fast count implementation.

DatabaseEXPLAINIndexes
0 likes · 9 min read
Performance Comparison of MySQL COUNT Queries on InnoDB and MyISAM
php中文网 Courses
php中文网 Courses
Aug 26, 2024 · Backend Development

Using PHP count() Function to Determine Array and Object Lengths

This article explains PHP's count() function, its syntax and parameters, and provides step‑by‑step examples for counting simple and multidimensional arrays using both normal and recursive modes. It also shows how to output the results and highlights the differences between COUNT_NORMAL and COUNT_RECURSIVE.

PHPTutorialarray
0 likes · 4 min read
Using PHP count() Function to Determine Array and Object Lengths
Java Tech Enthusiast
Java Tech Enthusiast
Jan 13, 2024 · Databases

Understanding MySQL COUNT() Performance and Optimization Strategies

The article explains why counting rows in large MySQL tables—especially with InnoDB—can become slow, compares COUNT() performance across storage engines and query forms, and offers optimization tactics such as using metadata counts, EXPLAIN estimates, a dedicated counting table, or periodic batch processing for accurate or approximate results.

DatabaseInnoDBMySQL
0 likes · 12 min read
Understanding MySQL COUNT() Performance and Optimization Strategies
php中文网 Courses
php中文网 Courses
Jan 5, 2024 · Backend Development

Understanding PHP count() and sizeof() Functions: Differences, Usage, and Tips

This article explains the PHP count() and sizeof() functions, clarifying that they are aliases with identical behavior, showing basic usage examples, discussing when to prefer one over the other, and offering performance notes, recursive counting, and object handling tips for developers.

PHParraysbackend
0 likes · 4 min read
Understanding PHP count() and sizeof() Functions: Differences, Usage, and Tips
php中文网 Courses
php中文网 Courses
Dec 16, 2023 · Databases

Why EXISTS() Is More Efficient Than COUNT() in MySQL and Laravel

Using MySQL's EXISTS() function for existence checks is generally more efficient and readable than COUNT(), especially in large datasets, and Laravel provides convenient query builder methods to implement EXISTS() queries, offering performance gains over COUNT() in PHP applications.

Database OptimizationEXISTSLaravel
0 likes · 6 min read
Why EXISTS() Is More Efficient Than COUNT() in MySQL and Laravel
php中文网 Courses
php中文网 Courses
Aug 23, 2023 · Backend Development

Using PHP substr_count() to Count Substring Occurrences

This article explains the PHP substr_count() function, its syntax, parameters, and demonstrates how to count substring occurrences with optional offset, length, and case‑sensitivity options through clear code examples.

case-sensitivecount()length
0 likes · 4 min read
Using PHP substr_count() to Count Substring Occurrences
php中文网 Courses
php中文网 Courses
Jul 25, 2023 · Backend Development

Understanding PHP count() Function: Syntax, Parameters, Usage, and Common Issues

This article explains the PHP count() function, covering its syntax, required and optional parameters, return values, practical examples for arrays, objects, and multidimensional structures, as well as common pitfalls and best practices for accurate length calculations.

arraybackendcount()
0 likes · 5 min read
Understanding PHP count() Function: Syntax, Parameters, Usage, and Common Issues
php中文网 Courses
php中文网 Courses
Jul 11, 2023 · Backend Development

How to Get Array Length in PHP Using count() and sizeof()

This article explains how to determine the length of one‑dimensional and multi‑dimensional arrays in PHP using the count() and sizeof() functions, shows code examples, discusses the two optional parameters of count(), and provides guidance on handling empty or undefined arrays.

arraybackendcount()
0 likes · 4 min read
How to Get Array Length in PHP Using count() and sizeof()
php中文网 Courses
php中文网 Courses
Jul 11, 2023 · Backend Development

How to Count the Number of Keys in a PHP Array

This article explains several PHP techniques—including the count function, array_keys, foreach loops, and end/key combination—to determine how many keys an array contains, providing code examples and explanations for each method.

arraybackendcount()
0 likes · 5 min read
How to Count the Number of Keys in a PHP Array
macrozheng
macrozheng
Jan 30, 2023 · Databases

Why Is MySQL count(*) So Slow and How to Supercharge It

This article explains why MySQL count(*) queries can become a performance bottleneck on InnoDB tables and presents practical optimization techniques such as Redis caching, secondary caches, multithreading, reducing joins, and even switching to ClickHouse for massive datasets.

CachingDatabaseMySQL
0 likes · 10 min read
Why Is MySQL count(*) So Slow and How to Supercharge It
macrozheng
macrozheng
Sep 30, 2022 · Databases

Why MySQL count(*) Slows Down on Large Tables and How to Optimize It

This article explains how MySQL's count() works across different storage engines, compares the performance of various count() forms, and offers practical strategies—such as using EXPLAIN rows, auxiliary count tables, and batch processing—to obtain accurate or approximate row counts efficiently even on massive tables.

InnoDBMyISAMMySQL
0 likes · 13 min read
Why MySQL count(*) Slows Down on Large Tables and How to Optimize It
IT Services Circle
IT Services Circle
Jul 6, 2022 · Databases

Understanding MySQL COUNT() Performance and Strategies for Large Tables

This article explains how MySQL COUNT() works under different storage engines, why counting rows becomes slow on large InnoDB tables, and presents practical methods such as using EXPLAIN rows, auxiliary count tables, batch processing, and transaction‑based updates to obtain approximate or exact row counts efficiently.

DatabaseInnoDBMonitoring
0 likes · 12 min read
Understanding MySQL COUNT() Performance and Strategies for Large Tables
Architect's Tech Stack
Architect's Tech Stack
Feb 14, 2022 · Databases

Optimizing Existence Checks: Replace COUNT(*) with SELECT 1 LIMIT 1

The article explains why using COUNT(*) to test for record existence is inefficient and demonstrates how replacing it with SELECT 1 … LIMIT 1 in SQL and a corresponding Java existence check can significantly improve database query performance.

DatabaseOptimizationPerformance
0 likes · 3 min read
Optimizing Existence Checks: Replace COUNT(*) with SELECT 1 LIMIT 1
Laravel Tech Community
Laravel Tech Community
Jun 2, 2021 · Databases

Differences and Performance of count(1), count(*), and count(column) in MySQL

The article explains the functional differences and performance characteristics of MySQL's count(1), count(*), and count(column) expressions, showing when each is appropriate and providing a concrete example with query results to illustrate their behavior.

DatabaseMySQLPerformance
0 likes · 4 min read
Differences and Performance of count(1), count(*), and count(column) in MySQL
php中文网 Courses
php中文网 Courses
Apr 22, 2021 · Backend Development

Using PHP count() and sizeof() Functions to Count Array Elements and Object Properties

The article explains PHP's count() function (alias sizeof()), its syntax, parameters—including the optional COUNT_RECURSIVE mode—and demonstrates how to count array elements and object properties with practical code examples, highlighting return values and behavior with null or non‑countable inputs.

PHParraybackend
0 likes · 3 min read
Using PHP count() and sizeof() Functions to Count Array Elements and Object Properties
Python Programming Learning Circle
Python Programming Learning Circle
Jan 12, 2021 · Databases

Differences Between count(1), count(*), and count(column) in SQL

This article explains the functional and performance differences among SQL count(1), count(*), and count(column) expressions, including how they handle NULL values and when each method is most efficient, illustrated with a MySQL example.

DatabaseMySQLPerformance
0 likes · 5 min read
Differences Between count(1), count(*), and count(column) in SQL
Laravel Tech Community
Laravel Tech Community
Dec 13, 2020 · Backend Development

PHP count() Function – Counting Elements in Arrays and Objects

The PHP count() function returns the number of elements in an array or the number of properties in an object, with an optional recursive mode for multidimensional arrays, and includes details on its signature, parameters, return values, and practical code examples.

PHParraycount()
0 likes · 3 min read
PHP count() Function – Counting Elements in Arrays and Objects
Architect
Architect
Nov 5, 2020 · Databases

Differences Between count(1), count(*), and count(column) in MySQL

This article explains the functional and performance differences among MySQL's count(1), count(*), and count(column) functions, illustrates how NULL handling varies, and provides a concrete example demonstrating their results and execution efficiency under different table schemas.

DatabaseMySQLPerformance
0 likes · 5 min read
Differences Between count(1), count(*), and count(column) in MySQL
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Sep 16, 2020 · Databases

Is MySQL count(1) Really Faster Than count(*)?

This article examines whether MySQL's count(1) is faster than count(*), explains how InnoDB processes both expressions identically, compares them with count(column), and offers practical advice on avoiding costly full‑table counts.

DatabaseInnoDBMySQL
0 likes · 5 min read
Is MySQL count(1) Really Faster Than count(*)?