Re: Is it better keep most logic in the database or the Node.js application?

From: Simon Connah <simon(dot)n(dot)connah(at)protonmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: Is it better keep most logic in the database or the Node.js application?
Date: 2021-03-19 19:09:38
Message-ID: Fso8H37elSuDDELA0XCCPxAqN5GnLKXhyIFJ-hZIhN97lclRwZZpQxi8_9i9H9j0E5HV7YeEwbOzixMpW_-BH2ahMg5skrtz9c0YyVc41lw=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Friday, March 19th, 2021 at 17:16, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Fri, Mar 19, 2021 at 08:37:48AM +0000, Simon Connah wrote:
>
> > Hi,
> >
> > I've been wondering this for some time but is it better to keep the vast majority of the logic in the database using functions, stored procedures, triggers and everything else or should I keep the SQL in the Node.js web application and use that to directly query the database object? I would have thought using database functions would be faster as the database will know what the query is ahead of time and can perform some optimisations on it but this is just a guess on my part.
> >
> > What should I do? Keep everything in the Node.js application or do as much as possible in PostgreSQL?
>
> I have a blog entry about it:
>
> https://momjian.us/main/blogs/pgblog/2017.html#June_14_2017
>
> ---------------------------------------------------------------------------------------------
>
> Bruce Momjian bruce(at)momjian(dot)us https://momjian.us
>
> EDB https://enterprisedb.com
>
> If only the physical world exists, free will is an illusion.

Thank you for the link. It was an interesting read.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bzzzz 2021-03-19 19:38:01 Re: Is it better keep most logic in the database or the Node.js application?
Previous Message Simon Connah 2021-03-19 19:08:58 Re: Is it better keep most logic in the database or the Node.js application?