Thread: Stored Procedures and compiling

Stored Procedures and compiling

From
Daniel Bruce Lynes
Date:
Hello.

I am curious if there is any planned support for full stored procedure
compiling?  I've seen that PostgreSQL does not compile the SQL code inside
plpgsql code.  It is merely interpreted when the procedure gets called.  This
is also documented in the main html documentation.

What I am wondering specifically is if stored procedure compiling will work
similar to Oracle's stored procedure compilation in the future?

Thanks

Re: Stored Procedures and compiling

From
Tom Lane
Date:
Daniel Bruce Lynes <dlynes@shaw.ca> writes:
> I am curious if there is any planned support for full stored procedure
> compiling?  I've seen that PostgreSQL does not compile the SQL code inside
> plpgsql code.  It is merely interpreted when the procedure gets called.  This
> is also documented in the main html documentation.
> What I am wondering specifically is if stored procedure compiling will work
> similar to Oracle's stored procedure compilation in the future?

What exactly do you consider "compiling", and why do you think that
whatever Oracle does (which you didn't bother to explain) is superior
to what plpgsql does?

            regards, tom lane

Re: Stored Procedures and compiling

From
Daniel Bruce Lynes
Date:
On Friday 07 March 2003 19:13, Tom Lane wrote:

> What exactly do you consider "compiling", and why do you think that
> whatever Oracle does (which you didn't bother to explain) is superior
> to what plpgsql does?

When you run a script to place a stored procedure into Oracle, it checks the
entire script to ensure that there are no syntax errors in both the
procedural code and the SQL code.  However, with PostgreSQL, if there are
errors in the code, I usually don't find out about it until I reach that
branch in the logic upon execution of the stored procedure from client code.

As I understand it, Oracle also compiles the stored procedure into pcode
(internally), the first time it is called so that it runs faster.  You can
compile stored procedures into pcode manually also, and store the pcode in
the database, rather than the pl/sql code.