more unhinged HN energy disconnected from reality
Post
Remote status
more unhinged HN energy disconnected from reality
Replies
18everyone who says "it's terrible to use these database features, this should all be application logic because... testing, and $reasons" seem to be from people who are NoSQL-brained and can't escape it
@feld maybe it depends on the features. When I was a DBA the programmers (ok, I also programmed too) avoided many database features. Stored procedures were harder to upgrade and were slower. There was a dream of being cross DB compatible too by sticking to the SQL standards as much as possible. We’d lived through many tech changes and wanted to minimize work if it’d be needed again.
@feld the problem is that queries in the sproc either didn’t get optimized, or bypassed the cache I think. I think Percona used to have a blog post about it.
@feld I've always opted towards views before stored procedures but I remember having to do a few things with Microsoft SQL Server that needed to be done as stored procedures and there's something to say for having some programmatic logic be there instead of inside of if your application (especially if you're using different technology stacks for different applications).
@sun@shitposter.world @feld@friedcheese.us how often you're transitioning between DB vendors anyways?
(also, since writing them is litteraly part of my job, the best use cases I'd say are either small ones for ensuring nore complex consistency terms of the database, or large ones for bulk data transformation and saving.
I am very against using stored procedures unless you can can bring a strong case for why your usage doesn't get us swamped for life on one platform.
@sun@shitposter.world @feld@friedcheese.us ok, I understand it with oracle because of it's toxic licensing
But like, I've rewritten a whole bunch of stored procedures - e.g. from postgres to mssql and then back to postgres after some changes while it lived in mssql. Was fine.
And yes, if you put all of it in stored procedures, you're gonna have a bad time migrating (guess why oracle wants you to use them so much), but as I said, you should have either small ones for consistency, or large ones for large transformations/analytics. The first case is easy to rewrite because small, the second case is a pain either way because the alternative is just having all of the sql in some script or whatever and you're gonna have to rewrite it either way.
it's like they turned the database into an operating system
@feld@friedcheese.us @sun@shitposter.world ok thats bonkers and stupid
Both because it's on oracle, and because SQL is kinda ass for such code volume