[wp-trac] [WordPress Trac] #62774: The query in the count_user_posts function within wp-includes/user.php can be optimized to improve performance.
WordPress Trac
noreply at wordpress.org
Fri Jan 3 06:53:49 UTC 2025
#62774: The query in the count_user_posts function within wp-includes/user.php can
be optimized to improve performance.
---------------------------+-----------------------------
Reporter: deepakrohilla | Owner: deepakrohilla
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Keywords: has-patch
Focuses: performance |
---------------------------+-----------------------------
Since the wp_posts table's ID column is indexed (as it is the primary key
and has a dedicated index), using COUNT(ID) will be faster than COUNT(*)
because MySQL can leverage the index for efficient counting. In InnoDB
tables, COUNT(*) often requires a full table scan or index traversal since
InnoDB does not maintain an exact row count. Therefore, replacing COUNT(*)
with COUNT(ID) can improve query performance.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62774>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list