← Back to context

Comment by _heimdall

10 hours ago

Its always a very interesting architectural question when deciding at what level(s) the business logic should live. There absolutely are valid reasons for some to go in SQL, though I tend to avoid putting the most complex logic there when its really tricky.

When it really gets hairy, or when the business logic keeps changing under my feet, I'll try to find constraints I can put in the db as a final backstop while leaving most of the logic somewhere in the application stack.

I can count on one hand the number of people I've worked with that really know SQL well enough to pick up complex business logic at that layer and work with it easily. I've been mainly in small companies for the last decade, I'm sure at larger orgs there are more data engineers running around that could own it.