Re: Prepared statements versus stored procedures - Mailing list pgsql-general

From David G. Johnston
Subject Re: Prepared statements versus stored procedures
Date
Msg-id CAKFQuwZXD91VWGASxwotrOi_ftdbrC+kV-jvORupfE_PdkCxCQ@mail.gmail.com
Whole thread Raw
In response to Re: Prepared statements versus stored procedures  (Francisco Olarte <folarte@peoplecall.com>)
List pgsql-general
On Sun, Nov 19, 2023 at 11:09 AM Francisco Olarte <folarte@peoplecall.com> wrote: 
IIRC it does it once per
transaction, but it should be in the docs.

There is no external caching for executing a CALL; the runtime executes the procedure afresh each time.  If it were any different that would have to be documented.

You do not
turn a stored procedure into a statement, you turn CALLING the stored
procedure into a prepared statement,

Which is not possible.  CALL is not a valid target for PREPARE; the valid ones are documented.

The fact that store procedures do not return result sets - and are procedures - and prepared statements are not procedures and can return result sets makes any kind of direct comparison pretty meaningless in practice.  They do different things and solve different problems.  Know what the problem you are trying to solve is and which of the two are plausible options will make itself clear.

David J.

pgsql-general by date:

Previous
From: Simon Connah
Date:
Subject: Re: Prepared statements versus stored procedures
Next
From: "PGUser2020"
Date:
Subject: How can I return a UTF8 string from a hex representation in a latin9 database?