Informix Error -301
-301 The total size of the GROUP BY columns is too big.
The database server limits the total number of bytes in the combined columns that the GROUP BY clause lists. All database servers support at least 120 bytes. See the discussion of error -300 for more information.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-301 is the byte-size sibling of -300's column-count limit: even with an acceptable number of
GROUP BY columns, their combined byte width can't exceed the server's implementation limit —
every server supports at least 120 bytes total. Wide character columns are the usual culprit,
since a handful of them can exhaust the budget well before hitting the column-count limit.
- A
GROUP BYclause listing a small number of columns, but wide ones — severalVARCHAR/CHARcolumns of significant declared length combined can exceed 120 bytes even with just two or three columns. - Grouping by columns wider than actually needed to distinguish groups — e.g. a long
description or comment column included in
GROUP BYwhen only its identifier is needed. - Schema growth — column widths increased over time (a
VARCHAR(20)widened toVARCHAR(100)), pushing a previously-fineGROUP BYclause over the limit without the query itself changing.
Solutions / Resolution
- Reduce the total byte width of the
GROUP BYcolumns, per the official guidance — group by narrower identifying columns instead of wide descriptive ones where possible. - See -300's staged restructuring approach if the query genuinely needs to distinguish rows by wide columns: group by narrow essential columns into a temp table, then join back to retrieve the wide columns afterward.
- Check for a recent column-width increase if a previously-working query starts failing — the query didn't change, but the underlying schema did.
Examples
Wide columns exceeding the byte budget
SELECT customer_name, shipping_address, billing_address, COUNT(*)
FROM orders
GROUP BY customer_name, shipping_address, billing_address;
-- -301: three VARCHAR(100)-class columns together exceed the
-- combined GROUP BY byte limit
Fix — group by a narrow identifying column instead, then join back for the wide ones:
SELECT customer_id, COUNT(*) AS cnt
INTO TEMP grouped_orders
FROM orders
GROUP BY customer_id;
SELECT o.customer_name, o.shipping_address, o.billing_address, g.cnt
FROM grouped_orders g, orders o
WHERE g.customer_id = o.customer_id;
Diagnostic Checks
- Sum the declared widths of every column in the
GROUP BYclause and compare against the server's documented byte limit (at least 120 bytes). - Check for a recent widening of any grouped column's data type if a query that used to work started failing without any query changes.
Related Errors / Related Topics
- -300 — "There are too many GROUP BY columns." The column-count sibling of this byte-size limit — see its addendum for the staged temp-table-and-join restructuring pattern, which applies equally here.
- -294 — "The column column-name must be in the GROUP BY list." The general
GROUP BY-membership requirement this limit sits alongside.
Group by narrow identifying columns and join back for wide descriptive ones — the same
restructuring pattern used for -300 resolves this byte-size limit too.