Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> > And if you treat the database as the source of truth for managing data, then the idea of making it an application engine would be anathema.

> Why? Could you elaborate more on that?

Sure.

Your previous declaration of:

> We argue that all "business logic" is in fact "data logic" and they're the same concern.

Is both the source of my position and your question.

For at least the last 50 years of which I am aware, the idea of "data rules all" has inextricably lead to migrating system logic closer to where the data resides. In the last 35-ish years, this meant defining application logic in stored procedures executed in an RDBMS (such as what you describe).

This architectural philosophy is commonly know as "client/server", or "two-tier systems," and has been studied extensively (as I am sure you are aware). What makes this relevant to the argument found in the "Motivation" section on the PostgREST site is:

  Using PostgREST is an alternative to
  manual CRUD programming.
And then:

  The PostgREST philosophy establishes
  a single declarative source of truth:
  the data itself.
To achieve that, the logic must reside within the RDBMS in order to fulfill the project goal set forth in the very first line of the site's home page:

  PostgREST is a standalone web server
  that turns your PostgreSQL database
  directly into a RESTful API.
For all intents and purposes, PostgREST could be considered an RDBMS connection pool, with the connection protocol being HTTP. Note that this is not a judgement, only an observation.

Now, consider a different system architecture commonly known as "three-tier" or "multi-tier." The philosophy of this type of system is largely defined by separation of concerns. This is to say, have each tier be responsible for a single "layer" involved in system definition.

In multi-tier systems, the persistent store (RDBMS) is solely responsible for ensuring data integrity. It may, in fact, service disparate components as well as disparate components may use more than one persistent store. An example of the latter is PostgreSQL and Redis deployed in concert. Programs, components, and/or systems which interact with a persistent store are responsible for providing the behaviour expected by their clients whilst the persistent store is expected to enforce rules regarding the relationships it manages.

Since the persistent store is only asked to fulfill a data integrity contract, having it also attempt to be an application engine would clearly conflate concerns, limit what persistent stores could be used, as well as result in assumptive implementations. Hence anathema to those who would treat the persistent store (database) as the source of truth strictly for the one concern which it was designed to address:

Managing data.



I see what you mean. This is the view that considers that the database should only be a Persistence Layer and not a Processing Engine.

There is a great talk[1] that @felixyz shared regarding the shortcomings of the Persistence Layer approach and the advantages of Processing Engine approach(which we at PostgREST embrace).

In summary, having the "business logic" away from the db results in worse performance: more network roundtrips, ineffective cache utilization, wasted CPU cycles in traversing your programming language VM(plus all libs) code paths. Turns out this actually puts more strain on the DB and makes your whole system scale worse.

> Hence anathema to those who would treat the persistent store (database) as the source of truth strictly for the one concern which it was designed to address: Managing data.

I think marrying these concerns and having them in a single place is more of a benediction for OLTP systems development and maintenance. After all, PostgreSQL has gotten more powerful features over the years and it has evolved to do more than data management(LISTEN/NOTIFY, JIT, etc).

I really recommend watching that talk. Btw, slides here[2].

[1]: http://www.prohuddle.com/webinars/ToonKoppelaars/ThickDB.php

[2]: https://www.nloug.nl/downloads/ogh20170615_toon_koppelaars.p...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: