Craig Ringer <craig@xxxxxxxxxxxxxxxxxxxxx> writes: > That function hits the database repeatedly. If the problem is in fact > with a database query that it's generating you need to determine which > one. You could step through the function with a PHP debugger or just > insert log/printing statements in the function so you can see its progress. Even easier, turn on query logging (log_statement = all), run the function, and then look in the postmaster log to see what happened. 7.3 is a long time back, and I wouldn't be surprised if you are hitting some compatibility issues in trying to make the jump to 8.3 in one step. It's hard to tell what though ... I don't find that PHP code very readable. regards, tom lane