# ERROR 1114 (HY000): The table '/tmp/#sql_xxxx' is full

- **ID:** `database/mysql-temp-table-full`
- **Domain:** database
- **Category:** resource_error
- **Error Code:** `1114`
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

MySQL's temporary table storage (either in-memory or on disk) has run out of space, often due to a large query that creates an oversized temporary table exceeding tmp_table_size or max_heap_table_size.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| MySQL 8.0 | active | — | — |
| MySQL 5.7 | active | — | — |
| MariaDB 10.6 | active | — | — |

## Workarounds

1. **Increase both tmp_table_size and max_heap_table_size in MySQL configuration:
[mysqld]
tmp_table_size = 256M
max_heap_table_size = 256M
Then restart MySQL.** (90% success)
   ```
   Increase both tmp_table_size and max_heap_table_size in MySQL configuration:
[mysqld]
tmp_table_size = 256M
max_heap_table_size = 256M
Then restart MySQL.
   ```
2. **Optimize the query to avoid large temporary tables, e.g., by adding indexes, using LIMIT, or rewriting JOINs to reduce intermediate result sets.** (85% success)
   ```
   Optimize the query to avoid large temporary tables, e.g., by adding indexes, using LIMIT, or rewriting JOINs to reduce intermediate result sets.
   ```

## Dead Ends

- **Increasing only tmp_table_size without checking max_heap_table_size** — MySQL uses the smaller of tmp_table_size and max_heap_table_size for in-memory temp tables; both must be increased. (80% fail)
- **Deleting files from /tmp directory manually** — Temporary tables are managed by MySQL; manual deletion can cause corruption or errors, and space will not be freed immediately. (90% fail)
