Re: Is it considered good practice to use stored procedures for most tasks?

From: Gaetano Mendola <mendola(at)gmail(dot)com>
To: Steve Horn <steve(at)stevehorn(dot)dev>
Cc: Simon Connah <scopensource(at)gmail(dot)com>, pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: Is it considered good practice to use stored procedures for most tasks?
Date: 2019-04-18 11:10:29
Message-ID: CAJycT5rCC-3jN=zREbMBR8A8qFRH=1S47xRSnQRxVOgt5JRLMw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Because in case of change in the database structure you can avoid to touch
the application, also due the fact you can change table definitions inside
a transaction you can even upgrade your database without downtime

On Thu, Apr 18, 2019, 01:04 Steve Horn <steve(at)stevehorn(dot)dev> wrote:

> Do you have a "why" for your suggestion for not allowing direct table
> access?
>
>
> On Wed, Apr 17, 2019 at 4:32 PM Gaetano Mendola <mendola(at)gmail(dot)com> wrote:
>
>> For sure do not allow your application to touch directly tables, use
>> views and sp, lately I'm abandoning views for table functions.
>>
>> On Wed, Apr 17, 2019, 21:02 Simon Connah <scopensource(at)gmail(dot)com> wrote:
>>
>>> Hi,
>>>
>>> I'm about to build a website using PostgreSQL and for the first time I
>>> am not going to be using an ORM. I want to do it manually because I want
>>> to take the time to learn to use PostgreSQL properly on its own. The
>>> question is should I use stored procedures for the majority of the
>>> database operations or should I just use ad hoc queries as and when I
>>> need them? The advantage I can see for stored procedures is that you can
>>> do complex queries just by calling a single function rather than having
>>> to make multiple queries to get the result that you need. Plus it keeps
>>> the majority of data handling code at the database level rather than in
>>> the application itself.
>>>
>>> I was wondering what the consensus was for this? Should I try and use
>>> stored procedures as much as possible or should I only use them for
>>> specific types of tasks?
>>>
>>>
>>>
>>>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Laszlo Forro 2019-04-18 11:12:39 Re: Is it considered good practice to use stored procedures for most tasks?
Previous Message Laurenz Albe 2019-04-18 08:36:13 Re: Is it considered good practice to use stored procedures for most tasks?