Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would propose to have a hybrid between <a href="https://en.wikipedia.org/wiki/Database_normalization" rel="nofollow">normalized</a> data and <a href="http://en.wikipedia.org/wiki/Denormalization" rel="nofollow">denormalized</a> data .<br> So using the normalized structure provided by <em>eggyal</em> i would do the following denormalized structure :</p> <pre><code>CREATE TABLE Items_Tags_Denormalized ( Item_ID BIGINT UNSIGNED REFERENCES Items (Item_ID), Tags BLOB, PRIMARY KEY (Item_ID) ) ENGINE=InnoDB; </code></pre> <p>In column <code>Tags</code> you would have all the tags (<code>Tag_Title</code>) for the corresponding <code>Item_ID</code>.<br> Now you have 2 ways to achieve this: </p> <ul> <li><p>create a cron that runs periodically which will build this table <code>Items_Tags_Denormalized</code> using <code>GROUP_CONCAT</code> or whatever suits you (advantage: doesn't put additional load when you insert or delete in <code>Items_Tags</code> table; disadvantage: the denormalized table will not always be up to date (depending on how often do you run the cron))</p></li> <li><p>create <a href="http://dev.mysql.com/doc/refman/5.0/en/trigger-syntax.html" rel="nofollow">triggers</a> for <code>Items_Tags</code> table on insert and delete in order to keep up to date the <code>Items_Tags_Denormalized</code> table (advantage: the denormalized table will always be up to date;disadvantage: additional load when you insert or delete in <code>Items_Tags</code> table)</p></li> </ul> <p>Choose whatever solution suits your needs best considering the advantages and disadvantages.</p> <p>So in the end you will have the <code>Items_Tags_Denormalized</code> table from which you will <strong>only read without doing additional operations</strong>.</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. 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.
    3. 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