in reply to Foreach loop takes a long time to process and my report times out before page is rendered
Another tip:
- Do not use sort in
foreach $key ( sort keys %ctrl_tbl )
If you want to process your query-results sorted in some order, use ORDER BY in your query and fetch the results using selectall_arrayref or fetchall_arrayref. Then loop through the resulting array.