Wonderful Relation applies query caching in two different way:

  • Caching for Generating queries
  • Caching for Loading queries



Generating queries

When we generate a query which is reliing to other queries or with joins, we don’t need to genereate the query everytime. Literally we only have to generate it once. Wonderful Relations is in that point of view the tool to create the query and update it if changes happens. 


  • Cache Query

Conceptual we do not only have to store the table, we also have to store the temporary tables if any of connected queries has a temporary table, because before we could run the query we have to run the temporary tables. Since we differ beween normal and “count” queries we have to store this count query as well.

If the parameter cache_query is set, we store the resulting query in sql language in the following columns in the table wp_wr_query:

  • cached_query
  • cached_count_query
  • temporary_tables


Loading queries:

The second big part if queries are reused.

Example: If we generate a query, we access multiple configuration tables multiple times. The most used query may be the “get_query_by_identifier” query, which is runned before every query if no id is present. To  address this problem, we use a singlton pattern, so that every instance only a query if it hasn’t been loaded already. This also counts for count queries and temporary tables. 


    Your Cart
    Your cart is emptyReturn to Shop