title: MySQL server's thread_stack parameter - what is it? How big should it be?
body: <p>Couple days ago I got following error from MySQL database:</p>
  
  <blockquote>
    <p>Thread stack overrun: 68744 bytes used of a 196608 byte stack, and 128000 bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack.</p>
  </blockquote>
  
  <p>All documentation that I found says, that:</p>
  
  <blockquote>
    <p>The default is 64KB before MySQL 4.0.10 and 192KB thereafter. If the thread stack size is too small, it limits the complexity of the SQL statements that the server can handle, the recursion depth of stored procedures, and other memory-consuming actions.</p>
  </blockquote>
  
  <p>I set the variable thread_stack to 256K, but it was just a random value. For now it solved the problem, but i'd really like to know how big should it be, get some example values, or usages. E.g.:</p>
  
  <ul>
  <li>What can and what can't i do with 96KB (x KB) of thread stack? </li>
  <li>How to compute how big thread stack do i need?</li>
  </ul>