Viorel,
> The problem is that my web browser hangs on this query and stays that way a
> lot [like 30 minutes -- i forgot about it and after 30 minutes it was still
> trying to open the result page]
I think this is a problem inside one of the functions; either you have an
endless loop, or you are doing a huge unindexed join operation or something
similar. Enclosing the two functions inside a transaction by itself
shouldn't cause a time-out.
One thing that can mess things up vis-a-vis transactions:
If you have a function which does a series of large cascading updates -- that
is, the function uses the updated table from step #2 to perform step #3, and
step #3 to do step #4, and each update is 1000's of rows -- then execution
can really bog down due to the lack of VACUUMing between updates. However,
you can't VACUUM without committing the transaction.
Just in case, I'd suggest doing a VACUUM ANALYZE right before running your big
transaction.
--
Josh Berkus
Aglio Database Solutions
San Francisco