Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If the joins are slow, it may be because the tables did not have <code>FOREIGN KEY</code> relationships and indexes properly defined. If the tables had been properly normalized before, it is probably <em>not</em> a good idea to denormalize them into a single table <strong>unless they were not performant <em>with</em> proper indexing</strong>. <code>FOREIGN KEY</code> constraints require indexing on both the PK table and the related FK column, so simply defining those constraints if they don't already exist may go a long way toward improving performance.</p> <p>The first course of action is to make sure the table relationships are defined correctly and the tables are indexed, before you begin denormalizing it.</p> <p>There is a concept called <a href="http://en.wikipedia.org/wiki/Materialized_view" rel="nofollow"><em>materialized views</em></a>, which serve as a sort of cache for views or queries whose result sets are deterministic, by storing the results of a view's query into a temporary table. MySQL does not support materialized views directly, but you can implement them by occasionally selecting all rows from a multi-table query and storing the output into a table. When the data in that table is stale, you overwrite it with a new rowset. For simple <code>SELECT</code> queries which are used to display data <strong>that doesn't change often</strong>, you may be able to speed up your pageloads using this method. It is not advisable to use it for data which is constantly changing though. </p> <p>A good use for materialized views might be constructing rows to populate your site's dropdown lists or to store the result of complicated reports which are only run once a week. A bad use for them would be to store customer order information, which requires timely access.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload