Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add object caching of meeting queries #105

Open
dd32 opened this issue Oct 1, 2020 · 0 comments
Open

Add object caching of meeting queries #105

dd32 opened this issue Oct 1, 2020 · 0 comments

Comments

@dd32
Copy link
Member

dd32 commented Oct 1, 2020

The posts queries from the plugin are uncached and can sometimes be "expensive" comparatively to other queries due to their complexity.

Example query, which takes >5ms on WordPress.org:

SELECT wp_posts.*
FROM wp_posts
INNER JOIN wp_postmeta
   ON ( wp_posts.ID = wp_postmeta.post_id )
INNER JOIN wp_postmeta AS mt1
   ON ( wp_posts.ID = mt1.post_id )
INNER JOIN wp_postmeta AS mt2
   ON ( wp_posts.ID = mt2.post_id )
INNER JOIN wp_postmeta AS mt3
   ON ( wp_posts.ID = mt3.post_id )
INNER JOIN wp_postmeta AS mt4
   ON ( wp_posts.ID = mt4.post_id )
WHERE 1=1
AND ( ( wp_postmeta.meta_key = 'team' AND wp_postmeta.meta_value = 'polyglots' )
AND ( ( ( mt1.meta_key = 'recurring' AND mt1.meta_value NOT IN ('weekly','biweekly','occurrence','monthly','1') )
AND ( mt2.meta_key = 'start_date' AND CAST(mt2.meta_value AS DATE) >= CURDATE() ) )
OR ( ( mt3.meta_key = 'recurring'
AND mt3.meta_value IN ('weekly','biweekly','occurrence','monthly','1') )
AND ( ( mt4.meta_key = 'end_date' AND mt4.meta_value = '' )
OR ( mt4.meta_key = 'end_date' AND CAST(mt4.meta_value AS DATE) > CURDATE() ) ) ) ) )
AND wp_posts.post_type = 'meeting'
AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC

It'd probably be faster to just query all meeting entries and filter it in PHP...

@dd32 dd32 changed the title Add object caching Add object caching of meeting queries Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant