Mario Splivalo wrote: > Since the function is written in plpgsql I tried to calculate the > durations by using now() function, but realized that within the > transaction now() always retunrs the same value. Maybe you can use timeofday(). -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support