1- You have a query that runs for half an hour and you spoon feed the results to the client ?I'm guessing (2) - PG doesn't give the results of a query in a stream.(argh)2- Your script looks for new data every few seconds, sends a packet, then sleeps, and loops ?If it's 2 I have a readymade solution for you, just ask.