Sort aborted
Production Risk
Medium — query fails; no data corruption.
ER_FILSORT_ABORT (1028, SQLSTATE HY000) is raised when a filesort operation is aborted, usually because the query was killed, the connection was interrupted, or a disk-full condition occurred during the sort.
- 1Query was killed with KILL QUERY while filesort was in progress
- 2Disk became full while writing temporary sort files
- 3Client disconnected during a long-running ORDER BY query
-- Occurs when a running ORDER BY / GROUP BY sort is interrupted
expected output
ERROR 1028 (HY000): Sort aborted
Fix 1
Investigate why the sort was aborted
WHEN Error appears unexpectedly in application logs.
-- Check for disk space: -- df -h /tmp -- Check for killed queries in slow log or processlist SHOW PROCESSLIST;
Why this works
Identifying the cause (kill, disk-full, disconnect) determines the correct remediation.
Fix 2
Increase sort_buffer_size to reduce disk usage during sort
WHEN Sort is failing due to tmp disk pressure.
SET SESSION sort_buffer_size = 8388608; -- 8 MB
Why this works
A larger sort buffer keeps more of the sort in memory, reducing temp file writes.
✕ Set sort_buffer_size to hundreds of MB globally
sort_buffer_size is allocated per-connection; a very large global value can exhaust RAM when many connections sort simultaneously.
MySQL 8.0 — 1028 ER_FILSORT_ABORT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev