• Resolved sa55i

    (@sa55i)


    Hi dear, we have a lot of cpu’s spikes.

    We contacted our hosting (siteground) these are slow queries. We aren’t expert developer..Help us

    :
    
    1. Executed 49m 0s ago for 342.910438 sec on Database --> Unknown (NOT FOUND / DELETED)
    Date: 2023-04-20 11:23:33 Query_time: 342.910438 Rows_examined: 0: Rows_sent 0 Lock_time: 88.895993 Query_chars: 460
    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 ) WHERE 1=1  AND ( wp_postmeta.meta_key = '_elementor_priority' AND ( ( mt1.meta_key = '_elementor_location' AND mt1.meta_value = 'elementor_head' ) ) ) AND wp_posts.post_type = 'elementor_snippet' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC;
    -------------------------------------------------------------------------------------------------------------------
     2. Executed 48m 52s ago for 261.602106 sec on Database --> Unknown (NOT FOUND / DELETED)
    Date: 2023-04-20 11:23:41 Query_time: 261.602106 Rows_examined: 0: Rows_sent 0 Lock_time: 22.320906 Query_chars: 466
    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 ) WHERE 1=1  AND ( wp_postmeta.meta_key = '_elementor_priority' AND ( ( mt1.meta_key = '_elementor_location' AND mt1.meta_value = 'elementor_body_start' ) ) ) AND wp_posts.post_type = 'elementor_snippet' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC;
    -------------------------------------------------------------------------------------------------------------------
     3. Executed 48m 52s ago for 261.601335 sec on Database --> Unknown (NOT FOUND / DELETED)
    Date: 2023-04-20 11:23:41 Query_time: 261.601335 Rows_examined: 0: Rows_sent 0 Lock_time: 22.375772 Query_chars: 466
    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 ) WHERE 1=1  AND ( wp_postmeta.meta_key = '_elementor_priority' AND ( ( mt1.meta_key = '_elementor_location' AND mt1.meta_value = 'elementor_body_start' ) ) ) AND wp_posts.post_type = 'elementor_snippet' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC;
    -------------------------------------------------------------------------------------------------------------------
     4. Executed 48m 52s ago for 261.601297 sec on Database --> Unknown (NOT FOUND / DELETED)
    Date: 2023-04-20 11:23:41 Query_time: 261.601297 Rows_examined: 0: Rows_sent 0 Lock_time: 22.321062 Query_chars: 466
    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 ) WHERE 1=1  AND ( wp_postmeta.meta_key = '_elementor_priority' AND ( ( mt1.meta_key = '_elementor_location' AND mt1.meta_value = 'elementor_body_start' ) ) ) AND wp_posts.post_type = 'elementor_snippet' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC;

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author OllieJones

    (@olliejones)

    Please use the plugin’s About tab (Tools > Index MySQL > About) to upload your metadata, then reply here with the upload id. That way I can take a look at your situation.

    The queries you have shown are all the same: this;

    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 ) 
    WHERE 1=1  
    AND ( wp_postmeta.meta_key = '_elementor_priority'
    AND ( ( mt1.meta_key = '_elementor_location'
    AND mt1.meta_value = 'elementor_head' ) ) ) 
    AND wp_posts.post_type = 'elementor_snippet'
    AND ((wp_posts.post_status = 'publish')) 
    GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC;

    This fetches all columns from all published elementor snippets that have two specific metadata items, then orders them by priority.

    If you have many elementor snippets, it may not be possible to make this very fast. I can’t give you better advice without seeing your metadata.

    Thread Starter sa55i

    (@sa55i)

    Hi dear thx for your support

    This is my id

    Q6G8Z2W4

    Plugin Author OllieJones

    (@olliejones)

    Thanks for the upload.

    I see one possible database optimization. Your MySQL 5.7.39 server needs to use your SSD (or hard drive) to perform sorting — ORDER BY — operations roughly 4.5 times per minute in the ~50 days since it was started. That is many file-system sort operations. Information here.

    Your server’s sort buffer size is 2MiB. You can try increasing it to 4MiB. A larger sort-buffer size should reduce the use of SSD (or hard drive) to perform sorting. (Your slow queries require sorting.)

    You can try this out by issuing this SQL command from phpmyadmin or some other SQL client.

    SET GLOBAL sort_buffer_size=4194304;

    If it helps you can make it permanent by editing my.cnf, your MySQL configuration size. I won’t tell you how to do that here, because I am not familiar with the way your server machine is set up.

    Note: your server has a max_connections setting of 500, but since you started it ~50 days ago it has only used (Max_used_connections) 47 simultaneous connections at once. You can save RAM by decreasing max_connections. I would cut it in half, to 250. I mention this because sometimes people object to raising the sort buffer size by saying a sort buffer is needed for each connection.

    If you don’t have the skills or access needed to make this sort_buffer_size change, ask your hosting provider’s support team to do it.

    And, please tell Elementor about this slow-query problem. There are certainly some things they can do in their source code to make this more efficient for large numbers of snippets.

    • This reply was modified 1 year, 7 months ago by OllieJones.
    Thread Starter sa55i

    (@sa55i)

    Hi DEAR. Thx a lor for your GREAT SUPPORT
    A virtual beer for you.
    Try to follow your suggest.
    At the moment, thx a lot

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CPU SPIKES’ is closed to new replies.