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: "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Is it better keep most logic in the database or the Node.js application?
Date: 2021-03-19 08:37:48
Message-ID: iP1Q7A5jXefT-1pnTm_xe11oZwWMxeZydnC6UfZAOu4BesbseT2xtKgwpR_3FORbOpg44gUNHiH1N_9FRzCDyz98hXlIubXTRuTKX1TNFVA=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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?

Simon.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Laszlo Forro 2021-03-19 14:41:48 Re: Is it better keep most logic in the database or the Node.js application?
Previous Message Laurenz Albe 2021-03-17 12:41:47 Re: Understanding recovery conflict due to bufferpin