4103
MySQLWARNINGCriticalHIGH confidence

SQL_CALC_FOUND_ROWS is deprecated

Production Risk

Low — Queries still work, but the feature will be removed in a future release.

Why it happens
  1. 1A SELECT query uses the SQL_CALC_FOUND_ROWS modifier.

Fix

Use a separate COUNT(*) query for pagination

Use a separate COUNT(*) query for pagination
SELECT COUNT(*) FROM t WHERE condition; SELECT * FROM t WHERE condition LIMIT 10 OFFSET 0;

Why this works

Two separate queries replace SQL_CALC_FOUND_ROWS + FOUND_ROWS() and are more transparent and cacheable.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 4103 ER_WARN_DEPRECATED_SQL_CALC_FOUND_ROWS

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

← All MySQL errors