How to group by unbounded string

ttsBegin;

insert_recordset goLongQueriesFrequncy(MinTime,MaxTime,AvgTime,Repeated,SQLStatement)

select minof(tracetime) , maxof(tracetime), avg(tracetime), count(Statement), Statement from SysTraceTableSQL group by SysTraceTableSQL.Statement;

ttsCommit;

Hello, I’m trying to create new table with values from SysTraceTableSQL table where I want group by statements, but i cannot do that because I can’t group using unbound String, also I’m trying to fit in at least 10000 records per second that’s why i don’t use while selects