This document offers suggestions on how to workaround 322 timeouts for online Queries.
Is there a workaround for the 322 timeouts that my online Queries are getting?
This problem often occurs for complex queries:
1) Sometimes it can be corrected by increasing the limit parameter for the Userid. This can be done on the Sysview "ACTIVITY, System Activity" screen.
2) If this fails the query should be run in Batch mode.