title: mysql cartesian product tuning performance
body: <p>a premise: the result of the cartesian product of 3 tables of about 5'000 rows (I would love to go as high as 50'000 rows) is for a little program that i am writing...so all server tuning options will be for this one task. the server wont be needed in a "normal online use".</p>
  
  <p>So i ask, what system variables do i need to change for this very particular one time task?</p>
  
  <p>(as example: does changing the number of instances or the size of the chunks help for this task? maybe set join_buffer_size=to 10GB?)</p>
  
  <p>On the other hand , (fortunately?) I have a where condition which could help reduce the burden. This is the sql string:</p>
  
  <pre><code>SELECT tbl1.*, tbl2. *, tbl3. * 
  FROM  tbl1, tbl2, tbl3
  WHERE Ma1 &gt;= (Ma70 + Ma71 + Ma72) AND 
        Ma2 &gt;= (Ma80 + Ma81 + Ma82) AND
        Ma3 &gt;= (Ma90 + Ma91 + Ma92) AND
        MOD((Ma130 + Ma131 + Ma132), 180) = 0
  </code></pre>
  
  <p>tbl1,tbl2 and tbl3 have 15 columns each. in particular:</p>
  
  <ul>
  <li>tbl1 has columns Ma1,Ma70,Ma80,Ma90,Ma130</li>
  <li>tbl2 has columns Ma2,Ma71,Ma81,Ma91,Ma131</li>
  <li>tbl3 has columns Ma3,Ma72,Ma82,Ma92,Ma132</li>
  </ul>
  
  <p>(btw. I used indexes on all 3 tables and the optimizer did use them, but, on a smaller test sample(500 rows) the difference in fetch time was really insignificant (from 18 sec. to 12).  Maybe i used the indexes wrong)</p>