Stored procedures

From: Simon Connah <simon(dot)n(dot)connah(at)protonmail(dot)com>
To: pgsql-novice <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Stored procedures
Date: 2023-08-27 11:49:06
Message-ID: eXWbA7jWtEDZQJSHx3brQYIZX_tj1kEjvG3B1-Sye_0OaGrlBTBRWZ27b_lUuq2wjftN7LfdCbxWy-zfz1dYKXjckquiXaoLh_0CdaP96zI=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I'm building a website in Python using the Django framework and am using the ORM at the moment but I can see a few situations where I might need to write raw SQL. My question is do stored procedures execute faster when compared to queries you generate using Python and then send to PostgreSQL? I would assume they would as there is less communication between the two sides and also because PostgreSQL knows the stored procedure ahead of time it should be able to better optimise it.

Is that true? Does PostgreSQL use a JIT for stored procedures which make them faster than one-off queries?

Simon.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David G. Johnston 2023-08-27 14:15:28 Re: Stored procedures
Previous Message David G. Johnston 2023-08-14 18:04:33 Re: create read-only and revoke create function?