Egregoros

Signal feed

Timeline

Post

Remote status

Replies

18

everyone 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 anyway the argument against stored procedures was, one, you're probably doing it wrong and two, now you're locked into one vendor's system for life. that said I have implemented them before when I needed both the querying and custom aggregation

@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 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).

@ignaloidas @feld I have presided over at least ten different projects to migrate a company away from Oracle to PostgreSQL. In a previous job I left in 2010, almost everything was written using PL/SQL in Oracle. They are still using Oracle because it was impossible to rewrite them.

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.