there might also be a "plan B" option....the perl program to maintain a file of results which, if exists, is read in and pick up running the script from that point. this means that you can simply quit the program when needed, and start again at any later stage when it still makes sense to combine the earlier and current results from the SQL queries.
the hardest line to type correctly is: stty erase ^H