3381
MySQLERRORNotablePartitioningHIGH confidence

Wrong usage of partition pruning

Production Risk

Low — query fails; no data is returned.

How to reproduce
trigger — this will error
trigger — this will error
SELECT * FROM t PARTITION (p_nonexistent);

expected output

ERROR 3381 (HY000): Incorrect usage of partition pruning.

Fix

Verify partition names before using PARTITION clause

Verify partition names before using PARTITION clause
SHOW CREATE TABLE t; SELECT * FROM t PARTITION (p0);

Why this works

SHOW CREATE TABLE lists actual partition names that can be safely used in explicit partition selection.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3381 ER_WRONG_USAGE_PARTITION_PRUNING

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

← All MySQL errors