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

This query is killing my database #458

Closed
banago opened this issue Jun 27, 2018 · 4 comments
Closed

This query is killing my database #458

banago opened this issue Jun 27, 2018 · 4 comments

Comments

@banago
Copy link

banago commented Jun 27, 2018

Hi guys,

I see this query through mysql show full processlist and it's keeping the CPU of my database at 100% non stop:

SELECT `post_id`
    FROM `wp_postmeta`
    WHERE `wp_postmeta`.`meta_key` = 'amazonS3_info'
    AND ( `wp_postmeta`.`meta_value` LIKE '%s:3:\"key\";s:49:\"wp-content/uploads/2013/04/image-name.jpg\";%'
    OR `wp_postmeta`.`meta_value` LIKE '%s:3:\"key\";s:38:\"uploads/2013/04/image-name.jpg\";%' )

I see this is coming from this function: [customizer_background_image], if I'm not wrong: customizer_background_image. I cannot figure out why this is running non stop.

Through query monitor plugin I see this function running 10-30+ times for each page load: update_meta_cache(). I suspect these two issues are related.

Please help

@ianmjones
Copy link
Member

I suspect you're not using the latest version of WP Offload S3 Lite, there's a fix in it related to the attachment_url_to_postid() function that'll likely help.

@banago
Copy link
Author

banago commented Jun 28, 2018

I'm on 1.4.1, which is the latest version. What I'm going to do now is comment this line, since this seems to run non-stop:

add_filter( 'attachment_url_to_postid', array( $this, 'customizer_background_image' ), 10, 2 );

Let's see what happens.

@banago
Copy link
Author

banago commented Jun 28, 2018

@ianmjones, yes commenting that line out solved the problem. The CPU load has gone to minimum. Can you please explain to me if that line is supposed to run on for every image on each page load? Is this a bug, or there is something wrong with my setup? Thanks.

@scarstens
Copy link

bump

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

3 participants