3329
MariaDBERRORNotableQuery / DataMEDIUM confidence

Too many rows returned by FIND_IN_SET or similar function

Production Risk

Medium — query fails; no data is modified.

How to reproduce
trigger — this will error
trigger — this will error
SELECT FIND_IN_SET(id, (SELECT GROUP_CONCAT(id) FROM huge_table)) FROM t;

expected output

ERROR 3329 (HY000): Too many rows returned.

Fix

Use an indexed JOIN

Use an indexed JOIN
SELECT t.id FROM t JOIN huge_table h ON h.id = t.id;

Why this works

A JOIN with an index avoids materialising all IDs into a string.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3329 ER_TOO_MANY_FIND_ROWS

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

← All MariaDB errors