title: Optimizing for SELECT INTO OUTFILE
body: <p>I have a <code>SELECT INTO OUTFILE</code> query that can return up to ~160,000 rows or a few dozen megabytes of data. It takes a long time to run - like 20 minutes. If I do <code>LIMIT 100</code> the query takes a fraction of a second, so it seems like my query is probably optimized nearly as well as it can be.</p>
  
  <p>Are there any performance-improving techniques specific to <code>SELECT INTO OUTFILE</code>? For example, maybe there's some memory setting in <code>my.cnf</code> that helps or something.</p>
  
  <p>Note: this question is not about query optimization so please don't ask to see my query if that's what you're after. There's plenty of help on that available elsewhere. I'm asking for performance techniques that specifically improve <code>SELECT INTO OUTFILE</code> queries.</p>
  
  <p>I'm on Ubuntu, if that makes a difference.</p>