2 ms·
I'll answer in theory, because I haven't used it. And I assume there are lots of ways this theory breaks down in practice. The first (theoretical) benefit is t
by jeff-davis 4y ago
I'll answer in theory, because I haven't used it. And I assume there are lots of ways this theory breaks down in practice.
The first (theoretical) benefit is that it removes a lot of redundancy. Databases already offer a lot of things applications do for themselves, and typically it's a best practice to do those things in the database anyway to guard against application bugs. For instance, defining CHECK constraints is a best practice regardless of application validation. (There's a lot of disagreement over where the DB/app boundary is and how much overlap there should be.)
Second, databases can be declarative because they are managing the data itself. The presence of a constraint makes a guarantee about the data regardless of history (versions, changes, bugs, etc.). Similarly for declarative authorization (GRANT, RLS, etc.).
Third, these benefits compound when dealing with many smaller, hastily-written applications.