<table><tr><td style="">pablo added a comment.
</td></tr></table><br /><div><div><p><em>I have attached the latest ERD's.  These are printer-friendly (no color).  I had to jig the ERD tool's XML file for MySQL.</em></p>

<p>Hey Dan,</p>

<p>Sorry for the delay.</p>

<p>Overall, if we were to equate the ERD to syntax versus semantics, syntactically it's in relatively good shape - more below.</p>

<p>Thank you for the explanation on <strong>[PartTypeTable]</strong>.</p>

<p>On the <em>Associative Tables</em>, thank you for your response.  Let's leave them as they are defined.  We have some inconsistencies but the net effect is the same:  <strong>Primary Key</strong> versus <strong>Unique Key</strong>.   From my experience, the optimizer should treat a <strong>Primary Key</strong> like a <strong>Unique Key</strong></p>

<p>At some point we should change the following tables to define a <strong>Primary Key</strong> rather than a <strong>Unique Key</strong>:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">RelationTable</li>
<li class="remarkup-list-item">TagRemoteIdResourceRelationTable</li>
</ul>

<p>On <strong>[CollectionTable]</strong>, the (extremely) general guideline is if we are returning more than 10% of the data, it's more efficient to perform an index scan.  The actual percentage varies though.  Some <em>tricks</em> can be applied so that if predominantly a subset of columns are always returned, an index can be used to create a <em>mini-table</em>  The Optimizer/Planner is generally smart enough to perform a full index scan of this structure.</p>

<p>This method can be a bit fragile because if dependent queries add more columns, they <em>fall off</em> of the index and instead need to perform their full scan against the table.  I generally don't like to use this <em>piggyback</em> hack.  It's a bit brittle.</p>

<p><strong>Recap</strong></p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Eventually change <em>Associative Tables</em> that have <strong>Unique Key</strong> to <strong>Primary Key</strong> (like the rest)</li>
<li class="remarkup-list-item">Drop unnecessary indexes from <strong>[CollectionTable]</strong></li>
</ul>

<p>Thoughts?</p>

<p><a href="https://phabricator.kde.org/F5690877" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">F5690877: akonadi-mysql.pdf</a></p>

<p><a href="https://phabricator.kde.org/F5690878" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">F5690878: akonadi-mysql-birds-eye.pdf</a></p></div></div><br /><div><strong>TASK DETAIL</strong><div><a href="https://phabricator.kde.org/T7846" rel="noreferrer">https://phabricator.kde.org/T7846</a></div></div><br /><div><strong>To: </strong>pablo<br /><strong>Cc: </strong>dvratil, kde-pim, pablo<br /></div>