Subject RE: [firebird-support] sort record size of 69708 bytes is too big
Author Leyne, Sean
Si,

> I am trying to run the following sql, which is part of a stored proc:
>
> SELECT DISTINCT P.ID, P.USERID, U.USERNAME, P.MSG, P.POSTED,
> P.LAST_EDITED,
> P.LAST_EDITED_BY, U1.USERNAME, P.IPADDRESS, P.TOPICID,
U.SHOW_SIG,
> U.SIGNATURE
> FROM DNFBB_POSTS P
> LEFT JOIN DNFBB_TOPICS T ON (T.ID = P.TOPICID)
> LEFT JOIN DNFBB_USERS U ON (U.ID = P.USERID)
> LEFT JOIN DNFBB_USERS U1 ON (U1.ID = P.LAST_EDITED_BY)
> LEFT JOIN DNFBB_FORUMS F ON (F.ID = T.FORUMID)
> LEFT JOIN DNFBB_USERGROUPSTOFORUM UGUF ON (UGUF.FORUM_ID = F.ID)
> LEFT JOIN DNFBB_USERTOUSERGROUPS UTUG ON (UTUG.USERGROUP_ID =
> UGUF.USERGROUP_ID)
> WHERE (P.TOPICID = 1) AND (UTUG.USER_ID = 1);
>
> And if fails with error:
>
> Message: isc_dsql_prepare failed
>
> SQL Message : -904
> Unsuccessful execution caused by an unavailable resource.
>
> Engine Code : 335544758
> Engine Message :
> sort record size of 69708 bytes is too big

The use of the DISTINCT requires the engine to sort the result set to
'weed out' the duplicates.

The maximum sort record is 64KB in size.

What is the total length of the columns in the SELECT clause?


> Without the DISTINCT everything is OK.

This is curious...


Sean