Optimize Reading Meta Keys To removed slow queary
-
I’ve reviewed your plugin code and noticed that in the
get_content_calendar_datas
function, located in the following file:publishpress/modules/calendar/calendar.php
the code retrieves all meta keys from the database. This is causing slow query performance, especially when the
wp_postmeta
table contains a large amount of data. In our case, thepostmeta
table is around 7GB, leading to significant delays.Upon further investigation, I found that only three specific meta keys are actually being used. To optimize performance, we modified the function to retrieve only those three meta keys as an array, instead of querying all meta data. This adjustment has significantly improved the calendar view’s loading speed by eliminating the slow query.
As a suggestion, you could enhance the plugin by creating a backend settings form that allows users to specify which meta keys are required for the application. This would give users more control and flexibility, while also preventing unnecessary data retrieval. It would improve performance, especially for websites with large databases, by limiting the query to only the relevant meta keys defined by the user.
- You must be logged in to reply to this topic.