title: Query optimization - second opinion
body: <p>I am looking on a second opinion concerning query optimization.</p>
  
  <p>I run this query a large table (currently 12.000 rows but be lightning fast with 100.000's of records)</p>
  
  <pre><code>Select a.user_id
  from bf_user_meta a
  left outer join bf_user_meta b
  on a.meta_value =b.meta_value
  where a.meta_key = 'subsectoren'
  AND (a.user_id = '13' OR b.user_id = '13')
  OR a.meta_key = 'see_subsectoren'
  GROUP BY user_id
  </code></pre>
  
  <p>Now this query needs 13 seconds of execution time.</p>
  
  <p>I got indexes on user_id and meta_key</p>
  
  <p>Mysql caching is set on. </p>
  
  <p>My knowledge of join queries is rather low so I'm looking for advice on how to optimize this one.</p>