title: How can I limit the size of temporary tables?
body: <p>I have largish (InnoDB) tables in a database; apparently the users are capable of making SELECTs with JOINs that result in temporary, large (and thus on-disk) tables. Sometimes, those are so large that they exhaust disk space, leading to all sorts of weird issues.</p>
  
  <p>Is there a way to limit temp table maximum size <em>for an on-disk table</em>, so that the table doesn't overgrow the disk? <a href="https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_tmp_table_size" rel="noreferrer">tmp_table_size</a> only applies to in-memory tables, despite the name. I haven't found anything relevant in the <a href="https://dev.mysql.com/doc/refman/5.7/en/internal-temporary-tables.html" rel="noreferrer">documentation</a>.</p>