MySQL raises Error 1028 (ER_FILSORT_ABORT) when a sort operation is interrupted, usually due to insufficient resources or a killed query.
MySQL Error 1028: ER_FILSORT_ABORT (Sort aborted) means the server stopped a file sort mid-operation, often because of out-of-memory, low tmpdir space, or a user KILL command. Free disk space, raise sort_buffer_size, or rewrite the query to finish sorting successfully.
Sort aborted
Error 1028 signals that MySQL aborted an on-disk or in-memory sort before completion. The server returns SQLSTATE HY000 and stops sending rows back to the client.
The failure usually appears during SELECT ... ORDER BY, CREATE INDEX, or filesort phases in GROUP BY, making queries incomplete and breaking applications that expect a full result set.
Resource exhaustion tops the list. A filesort uses RAM first, then tmpdir space.
If either runs out, MySQL cancels the sort and raises ER_FILSORT_ABORT.
Administrative actions such as KILL QUERY or connection timeouts also force MySQL to stop the sort, triggering error 1028 on the client.
Free disk on tmpdir or move tmpdir to a larger volume. Increase sort_buffer_size and tmp_table_size so more of the sort stays in memory.
Rewrite the query to limit rows sorted with selective WHERE clauses.
If the query was killed manually, allow it to finish or schedule heavy sorts during low-traffic windows.
Large reporting queries sorting millions of rows often exceed tmpdir limits. Adding a suitable index on the ORDER BY column eliminates the filesort entirely.
ETL jobs that build composite indexes can hit error 1028 on small cloud instances.
Temporarily bump innodb_buffer_pool_size and attach higher-IOPS storage to avoid the abort.
Monitor tmpdir usage with performance_schema and alert at 70 percent capacity. Keep tmpdir on fast SSDs sized for peak sorts.
Design schema with covering indexes so production queries rarely need explicit sorts.
Galaxy’s AI copilot highlights missing indexes during query reviews, reducing filesort risk.
Error 1030 (HY000: Got error 28 from storage engine) also arises from disk shortages but during general writes, not just sorts. Free space to fix both.
Error 2013 (Lost connection to MySQL server) can appear when a long sort exceeds wait_timeout. Increase the timeout or paginate results.
.
No. The error only affects the temporary files used for sorting. Base tables remain intact.
Yes. After freeing resources or adding indexes, rerunning the query is safe and should complete.
Versions before 8.0.14 had less efficient memory management for filesort and see the error more often. Upgrading reduces risk.
Galaxy shows explain plans inline and warns about filesort steps, letting you optimize queries or add indexes before execution.