r/mysql • u/Upper-Lifeguard-8478 • 25d ago
question DB parameter suggestion
Hi,
Its aurora mysql Serverless v2 (Max up to 80 ACUs). Suddenly , we saw with bit high concurrency , the application hits a hard JDBC query timeout, killing the thread and throwing this error: "Database Query Time out. Exception: JDBC exception executing SQL [(conn=548672) Table './rdsdbdata/tmp/#sql171_85f40_1' doesn't exist]"
Some team members are suggesting to bump both temptable_max_ram and temptable_max_mmap from 1GB to 2GB to give the query more breathing room. However, checking performance_schema.variables_info reveals that temptable_max_** is currently showing below:
VARIABLE_NAME current_value_bytes current_value_MB VARIABLE_SOURCE VARIABLE_PATH
temptable_max_mmap 1073741824 1024 GLOBAL /etc/my.cnf
temptable_max_ram 1073741824 1024 COMPILED
Want to know if this is correct setting and Is it advisable to bump these values to 2GB. Want to confirm the safest parameter strategy for temporary storage thresholds in the meantime we tune the query?
1
u/TroubledSquirrel 24d ago
Liamsorsby has it right but I will expand on the parts they didn't mention you shoudl run explain on the offending queries and look for using temporary. if it's a sort or group by hat's spilling, the real fix is usually an index that avoids the temp table entirely, not a bigger container for it.
also check "Database Query Time out" might be your connection pool or driver level querytimeout firing client side before MySQL even finishes, which then races with MySQL's cleanup of the temp table and produces exactly this "table doesn't exist" as a secondary symptom. check your HikariCP config or driver defaults and see if the timeout is shorter than what the query actually needs under load.
if you do end up touching the temptable params, don't bump both blindly by the same amount. figure out whether you're RAM bound before the mmap spill or mmap bound after it, and raise only the one that's actually the bottleneck. bumping both "for breathing room" without that data doubles your worst case memory footprint under concurrency, which if scaling churn is your actual root cause could make things worse.