function slower than the same code in an sql file - Mailing list pgsql-performance

From CS DBA
Subject function slower than the same code in an sql file
Date
Msg-id 4EAA3597.3020202@consistentstate.com
Whole thread Raw
Responses Re: function slower than the same code in an sql file  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: function slower than the same code in an sql file  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-performance
Hi All ;

I have code that drops a table, re-create's it (based on a long set of
joins) and then re-creates the indexes.

It runs via psql in about 10 seconds.  I took the code and simply
wrapped it into a plpgsql function and the function version takes almost
60 seconds to run.

I always thought that functions should run faster than psql... am I wrong?

Thanks in advance

--
---------------------------------------------
Kevin Kempter       -       Constent State
A PostgreSQL Professional Services Company
           www.consistentstate.com
---------------------------------------------


pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: PostgreSQL 9.0.4 blocking in lseek?
Next
From: Tom Lane
Date:
Subject: Re: function slower than the same code in an sql file