1028
MariaDBERRORNotableQueryHIGH confidence

Sort aborted

Production Risk

Medium — query fails; no data corruption.

What this means

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.

Why it happens
  1. 1Query was killed with KILL QUERY while filesort was in progress
  2. 2Disk became full while writing temporary sort files
  3. 3Client disconnected during a long-running ORDER BY query
How to reproduce
trigger — this will error
trigger — this will error
-- 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.

Investigate why the sort was aborted
-- 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.

Increase sort_buffer_size to reduce disk usage during sort
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.

What not to do

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.

Sources
Official documentation ↗

MySQL 8.0 — 1028 ER_FILSORT_ABORT

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors