Sort record size of nnnnn bytes is too big


This error occurs when the size of an intermediate or final row in a GROUP BY or ORDER BY statement doesn't fit into 64kB (a few bytes less actually). You might be using some UDF in GROUP BY or ORDER BY that outputs VARCHAR(32765) or CHAR(32765) - which is quite common for string UDFs. You could try to redeclare those UDFs and reduce the size of output to see if it helps. If you are joining many tables just to get some additional lookup data, you can use MAX or MIN to shorten the group by list. See FAQ #304 for example.

This can also happen if you try to use DISTINCT on columns whose combined size exceeds 64kB. If this is the case, you can work around it by rewriting the query to use EXISTS instead of DISTINCT to detect the duplicates.


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous