Forums

Question on trimming database tables and slow query times (7 posts)

  1. redux
    Member
    Posted 6 years ago #

    We have a user on our network that currently has a wordpress database that is quite large, here is a sample query from our slow query logs:

    # Time: 050726 11:39:18
    # User@Host: xxxxx[xxxxx] @ localhost []
    # Query_time: 16 Lock_time: 0 Rows_sent: 10 Rows_examined: 207180
    use xxxxx;
    SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt <= '2005-07-26
    18:39:59' AND (post_status = "publish") GROUP BY wp_posts.ID ORDER BY
    post_date DESC LIMIT 0, 10;

    There appears to be the appropriate indexing in wp_posts -- is there anyway we can assist this user in trimming down his 208,000 table rows?

  2. error
    Member
    Posted 6 years ago #

    OPTIMIZE TABLE, perhaps? How did he get 207,000 posts? Nevermind, I don't want to know.

  3. redux
    Member
    Posted 6 years ago #

    Yeah I don't think the Optimize Table sequence is going to do much good here because we aren't talking about a bunch of left over Deletes, there are legitimately 207,000 rows here.

    The client appears to be cross referencing and pulling feeds from other sources. I'm not very familiar with blogging/rss to understand what he's doing here, he did have a cron setup to run every minute, auto/post.php (Is this a script included with wordpress for getting feeds?)

  4. Mark (podz)
    Support Maven
    Posted 6 years ago #

    wp-cache may be useful ?
    http://mnm.uib.es/gallir/wp-cache-2/

  5. redux
    Member
    Posted 6 years ago #

    Thanks for that link, I will recommend the client give it a go, we may end up implementing it for him just to get it done quicker.

    Besides that, is there no realistic way to archive and then remove rows in wp_posts?

    Client is also curious, we'd like to remove about 180,000 of the posts.

  6. Mark (podz)
    Support Maven
    Posted 6 years ago #

    If for instance you wanted to remove posts that were made between two dates, that could be done with an sql query. If he wanted to more selective ... could be very tricky / long-winded.

    If the client is also curious, it strikes me that maybe he should have looked a bit more at the effect of the code, and has he indicated that he will abandon what he is currently doing ?

  7. davidchait
    Member
    Posted 6 years ago #

    and there's no reason a cron job has to run every minute! that could be turned down.

    No, there is no 'reblogging' script or plugin provided with WP.

    Yes, wp-cache is the best thing to throw in there. Note however that because it makes the pages basically static, some 'dynamic' portions of the page may have to be coded up differently as includes that conform to a format wp-cache understands.

    -d

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.