[wp-trac] [WordPress Trac] #46709: AND ( mx_postmeta.meta_key = 'post_views_count' ) called when there is no need to
WordPress Trac
noreply at wordpress.org
Fri Mar 29 02:16:04 UTC 2019
#46709: AND ( mx_postmeta.meta_key = 'post_views_count' ) called when there is no
need to
--------------------------+-----------------------------
Reporter: vadikcoma | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 5.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hello, I might be in a wrong place, but we are totally lost. We are
optimizing a large WordPress website and came across this issue:
{{{
SELECT SQL_CALC_FOUND_ROWS mx_posts.ID
FROM mx_posts
INNER JOIN mx_postmeta
ON ( mx_posts.ID = mx_postmeta.post_id )
WHERE 1=1
AND ( ( YEAR( mx_posts.post_date ) = 2019
AND WEEK( mx_posts.post_date, 1 ) = 13 ) )
AND ( mx_postmeta.meta_key = 'post_views_count' )
AND mx_posts.post_type = 'post'
AND ((mx_posts.post_status = 'publish'))
GROUP BY mx_posts.ID
ORDER BY mx_postmeta.meta_value+0 DESC
LIMIT 1, 10
}}}
This query takes around 1 second to process on 500.000+ article database.
Homepage takes around 15 seconds to load due to similar requests.
Is it a WordPress bug that it starts running really slow on large sites?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46709>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list