Allowed memory … exhausted with over 3 million wp_postmeta entries
-
Dear developers,
I really like this plugin and I am using it for all my customers πOn one of my websites an error occurs when I just open the Maintenance plugin settings page. I can put the website in the maintenance mode and back, but the bottom of the settings page is not loaded (or/and I cannot apply another background image for the maintenance mode). The
debug.logshows me the following error:Got error 'PHP message: PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 1052672 bytes) in /web/alarmaa.de/wp-includes/meta.php on line 1194'I found out that this comes from having more than 3 million
wp_postmetaentries. And yes, they are important for my website, this is ok. Now I reprogram my code to store this huge amount of data in a separate database table.But maybe you are interested in this behavior and maybe you want to (if there is a need for) optimize your code for that nice plugin π Or maybe some other users get this error and want to know what is wrong …
Best wishes,
Wasilij
-
Hi,
Thank you for using our plugin!
On the Maintenance Settings page we have the section where you can choose which Posts and Pages you can exclude from displaying the Maintenance page. In order to load the list to choose from we need to query all the posts, so if you have a huge postmeta table, which WordPress loads when we query posts, you could run into this memory issue if the limit is set too low. This will happen in other places as well, it’s not really related to Maintenance.I would suggest you increase your memory limit. It looks like it’s already 4GB so there must be a lot of data in that postmeta but I don’t have any other ideas π
Hi @talextech,
thank you for your reply.I understand the feature you describe and this is cool. I can imagine this query could be accomplished by just requesting the
wp_poststable without using anJOINSQL query that is probably performed by WordPress when using the i.e.get_post()function or other WordPress functions. But also here I understand you that you just use the standard functions. In such a large database I had to optimize often my code to keep the performance high by using$wpdband just querying what is really needed …But this is ok, not really an issue for me anymore since I moved the related data to a custom database table. But maybe for other users to know if they experience this behavior.
Thank you anyway!
WasilijYes, we try to use default WordPress functions wherever possible, in this case we use
get_posts()πIn the PRO version we just let users enter the actual URLs/slugs they want to include/exclude instead of loading a list of post/pages so that they can exclude any URL.
Nice π
Thank you for your time.
The topic ‘Allowed memory … exhausted with over 3 million wp_postmeta entries’ is closed to new replies.