thread_stack in my.cnf
Set thread_stack to stop stack overflows in routines — it is not a throughput knob.
thread_stack is the per-connection stack size. It matters when stored programs, deep views, or pathological expression trees overflow the stack.
Floor
[mysqld]
thread_stack = 256K
Raise carefully: each connection reserves stack. Thousands of connections × oversized stacks is real RAM.
Not a performance lever
It does not speed queries, replace indexes, or substitute for max_allowed_packet / buffer pool tuning. It prevents a class of crashes.
Prefer fixing causes
- Shallower stored-program recursion
- Simpler views
- Less monstrous generated SQL
Set a known-good value for your version, watch for stack crashes after upgrades, then leave it alone.