title: Slow query with lot of joins and 'IN' statement
body: <p>I have a very slow query and I believe this is due to the 'IN' statement. The list of ids in the 'IN' statement can be very large, like 250+. This query will run for 2+ seconds every time, and that is too slow.</p>
  
  <p>Is there a way to speed this up?</p>
  
  <pre><code>SELECT u.achternaam as achternaam, u.code as code, srt.niveaus as niveaus, srt.soortid AS soortid,IFNULL( scr.gehaald,'0')AS gehaald, IFNULL( scr.gespeeld,'0')AS gespeeld, IF( srt.niveaus =1,'n.v.t.', IFNULL(scr.huidigniveau,'0') )AS niveautext 
  FROM gebruikers u 
  LEFT JOIN ( SELECT scoreid,schoolcode, soortid, userid, gehaald, gespeeld, huidigniveau 
              FROM scores) scr
  ON scr.userid = u.code              
  LEFT JOIN ( SELECT soortid,niveaus,spelid,titel,verberg 
              FROM soorten 
              WHERE soortid IN (13,14,15,16,17,561,566,567,568,574,575,1,100,101,102,103,104,105,107,108,109,11,110,112,113,114,115,116,117,118,12,120,121,122,123,124,125,126,127,128,129,130,131,133,134,137,138,140,141,144,145)) srt
  ON scr.soortid = srt.soortid
  LEFT JOIN(SELECT spelnaam,spelid,vakid FROM spellen) g
  ON srt.spelid=g.spelid
  LEFT JOIN(SELECT vakid,vaknaam FROM vakken) vak
  ON g.vakid=vak.vakid
  WHERE u.groepsid='28' AND u.schoolcode ='1'  AND srt.verberg =0
  ORDER BY achternaam,vak.vaknaam,g.spelnaam,srt.titel ASC
  </code></pre>
  
  <p><strong>result of Explain Select</strong>:</p>
  
  <p><img src="https://i.stack.imgur.com/m5VT6.jpg" alt="explain"></p>