When you say breaks, does your cgi die, and if so, what is the output of the apache error log?
Potential reasons for breaking:
- its not really dieing, but because a lot is getting written to error logs (for whatever reason), takes quite a while.
- if you arent finish() ing your query handles within the loop, your program may be eating too many resources for mysql to handle, based on your configuration for max temp tables, etc. From Programming the Perl DBI (O'Reilly), Page 111: "After execute() returns successfully, the database has not necessarily completed the execution of the SELECT statement..."
Anyway, the first thing i'd do is examine the mysql configs (show variables) for differences between the servers.