WordPress.org

Ready to get started?Download WordPress

Forums

Codex to include number of database queries for a given function (2 posts)

  1. devonmather
    Member
    Posted 10 months ago #

    Hey All,

    When looking up WordPress documentation it would be beneficial for a function in the codex e.g. get_site_url() to include how many queries it performs on the wp database. Many people might not be aware that each time a certain function is called it connects to the DB.

    If someone was aware that each time they use get_site_url() it performs a query on the database they might consider caching it in global variable to use across their site.

    Regards

  2. catacaustic
    Member
    Posted 10 months ago #

    I'm not sure that it would be that benificial... Mainly becaues from my (probably limited) experience, the people that would care about how many database calls are being made will know to put the result from a function call into a variable so there's only one call anyway, so there's no need for any more information to try and push that point home. Anyone that doesn't know/understand that they should be using variables for these sorts of things won't see the benefits in the first place, so having that sort of info is wasted on them.

    There's also the times when a function can have multiple dynamic database calls, and these can't be counted and displayed anywhere because the number of calls depends on various other external factors.

Reply

You must log in to post.

About this Topic