Support » Requests and Feedback » Category: Caching instead of SELECT * FROM categories

  • dalmaer


    hi guys –

    We are doing some performance work on our WordPress installation, and when we list out the SQL queries that are happening on a page, the #2 offender is “SELECT * FROM categories”.

    This is because we have a weird situation, and have hundreds of categories 🙂

    We hooked a memcache to hold these categories once, and trick $category_cache but the problem we ran into was that ONE of the get_categories() functions does NOT have a isset() check around it, so it is always called 🙁

    Is there any harm is putting that check on all methods (or in the method in fact)?

    Thanks to your nice architecture, we have been able to hook in callbacks for all of our work so far (not needing to change any of your PHP).

    It would be great to have a hook to put in the function that returns the categories. By default it can be your get_categories(), but if we could:

    add_filter(‘get_categories_method’, ‘my_get_categories’)

    then people would be free to tweak things in anyway possible.

    Any thoughts?


    Dion Almaer

  • The topic ‘Category: Caching instead of SELECT * FROM categories’ is closed to new replies.