Thread: Compiling Stored Procedure

Compiling Stored Procedure

From
Danilo Freitas da Costa
Date:
Hi all,

    I'm new in postgre and I'm using the 8.1 version.
    I need do some [Stored] Procedure in the Database to gain more
performance in some queries execution. However, these SPs must be
compiled.
    Some SPs is already created in plpgsql. Is it possible compile
them? If not, how can I do that?

    I read about write functions in C, but I didn't found functions
using sql statements...

Thanks.
Danilo

Re: Compiling Stored Procedure

From
Richard Broersma Jr
Date:
> I'm new in postgre and I'm using the 8.1 version.
> I need do some [Stored] Procedure in the Database to gain moreperformance in some queries
> execution. However, these SPs must becompiled.
> Some SPs is already created in plpgsql. Is it possible compilethem? If not, how can I do that?
>
> I read about write functions in C, but I didn't found functionsusing sql statements...


The following link is a starting point for developing stored procedures using C.  However, most
advanced users recomend usings one of the trusted PL scripting languages because the development
time and code complexity is greatly reduced.  But if you are looking to develop advanced functions
SPI is where you should turn to.  The only other reason for using compiled C is to hide your
business logic from less advanced re-engineering coders.

http://www.postgresql.org/docs/8.1/interactive/spi.html


Regards,

Richard Broersma Jr.

Re: Compiling Stored Procedure

From
Richard Broersma Jr
Date:
> Thanks Richard.
> The SPI realy solve my needs...
> Sorry about incovenience, but do you have some sample of C coding withSPI??

Sorry, the only exprience with SPI that I have is knowing where to find information about it in
the Postgresql documentation.  :o)

That being the case, you should remember to "REPLY-ALL" when you respond to emails from this
mailing list, that way more experienced developers can chime in to help you with your problem.
Also, The pgsql-novice@postgresql.org mailing list probably isn't the best place to find answers
for an advanced topic like SPI programming.  I would try pgsql-general@postgresql.org or
pgsql-sql@postgresql.org.  I hope this helps.

Regards,

Richard Broersma Jr.