Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Main problem of this query is number of joins. I would suggest:</p> <ol> <li><p>Take nested query <code>f2</code> out and insert its output into table or temporary table, better with index. (With index it will change full table scan to index, speeding things up. Chances are high that such table will be reusable).</p></li> <li><p>lternatively to 1 or at the same time, swap <code>f1</code> and <code>f2</code>. You need to eliminate rows as early as possible. So first get the list of matches and timestapms you need, and join only necessary date. This query takes huge comments table and filters out unnecessary rows. It is easier to take 10% than through away 90% for the same result.</p></li> <li><p>Remove <code>Distinct</code> as it does nothing here: all joins are on equalities. If there any duplicates get data from all tables and find difference. Then add necessary <code>JOIN</code> condition to pick rows you need.</p></li> <li><p>Consider these <code>PRIMARY KEY</code>s: comments: <code>PRIMARY KEY (match_static_id)</code> matches_of_comments: <code>PRIMARY KEY (match_id)</code> new_iddaa: <code>PRIMARY KEY (match_id)</code></p> <p>Reason: Primary Key should be done on an often used column with meaning. Having it on technical <code>AUTOINCREMENT</code>ing column does not add value to the table.</p></li> <li><p>You may consider adding <code>flag</code> as a first column to <code>PRIMARY KEY</code>. It will add an overhead when <code>flag</code> is changed, but will speed up this query as all <code>flag=1</code> records will be in a single range and in a sequence on hdd. Hope this helps.</p></li> </ol>
    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.
    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