WordPress.org

Ready to get started?Download WordPress

Forums

Media Tags plugin excessive database queries? (6 posts)

  1. tictok
    Member
    Posted 4 years ago #

    Hi all -

    I'm optimising a wordpress (used as a CMS) site before it goes live for a client.

    My home page was averaging around 60 database queries (I know, very heavy, but drops to around 16 when using various cache plugins) and the rest of the pages averaged around 20 database queries.

    Over the past week however I'd added a few plugins and the number of MySQL queries has risen astronomically. I think last time I check the homepage alone generated around 460 database queries.

    With a bit of poking around and through elimination I've discovered the culprit is the Media Tags plugin which is a shame as its a great plugin and with a few hundred images stored in the media library was an essential tool for organising everything.

    Is this a bug in the plugin or is it this database heavy on purpose or by necessity?
    Does it really need to query the database 400ish times each page load?

    I've just uninstalled the plug-in and am going to stress test the site to see if page load improves under load....

    I'm hoping its a bug that can be fixed as I really appreciate the authors work and would love to be able to use the plugin.

    Thanks
    Stef

  2. taf2
    Member
    Posted 4 years ago #

    do you know more specifically what calls from the plugin are triggering the 400+ sql queries?

  3. Paul Menard
    Member
    Posted 4 years ago #

    Stef,

    I'm the author of the Media Tags plugin. Not really sure why you are seeing 400+ queries. Can you install the WP Debug plugin or something and pass that information back to me either here or via email (paul@codehooligans.com).

    Also, would need to know a little more about how you are using the plugin on your site.

    As for the plugin it does very little direct SQL calls. Mostly since the Media Tags are stored in the Taxonomy system just like Post tags and Post Categories 95% of the Media Tags functionality is handled directly with built-in WordPress function calls.

    Kind Regards,
    Paul Menard
    http://www.codehooligans.com

  4. tictok
    Member
    Posted 4 years ago #

    Hi Paul & taf2 - thanks for your replies.

    Paul:
    I currently don't have the plugin installed, and the site is now live (but still kind of on-going dev too). I will try debugging as you suggest the next time there's a design or code update, probably in the next few weeks as its currently bedding in whith my client.

    However I wouldn't be surprised if the issue stems from some of my sloppy PHP coding (I'm still learning), or even a re-direct loop, although I'm pretty sure there are none of those.

    It's something I would like to resolve if possible though, so will mail you the debug details once I have them.

    Many thanks for your time, and fantastic plug-in!

    Kind regards
    Stef

  5. clope
    Member
    Posted 4 years ago #

    the problem is caused bei mediatags_rewrite.php which is calling $wp_rewrite->flush_rules() for every page load. it generates around 400 queries and should only be called when the plugin is activated.

    please fix it paul. it's such a great plugin

  6. Paul Menard
    Member
    Posted 4 years ago #

    clope, thanks for the pointer on this. Will investigate the change this weekend.

Topic Closed

This topic has been closed to new replies.

About this Topic