Stored Procedures Debate

This cluster centers on debates about using stored procedures in databases for business logic, highlighting pros like performance and data integrity against cons such as poor tooling, maintainability, and deployment challenges.

📉 Falling 0.4x Databases
2,059
Comments
20
Years Active
5
Top Authors
#1005
Topic ID

Activity Over Time

2007
1
2008
16
2009
30
2010
26
2011
108
2012
76
2013
65
2014
57
2015
99
2016
173
2017
123
2018
100
2019
172
2020
173
2021
158
2022
144
2023
251
2024
123
2025
161
2026
3

Keywords

DBA AWS TIL EDIT UI OO SQL HN SOAP i.e stored procedures procedures stored sql logic database business logic pl queries data

Sample Comments

andersmurphy Nov 11, 2025 View on HN

It's almost like stored procedures were a good idea.

lowbloodsugar Sep 16, 2017 View on HN

We use stored procedures. We actually use them for a different reason: we treat the database server as an application server that happens to use an proprietary binary protocol instead of HTTP. Its API is exposed using stored procedures. This allows us to maintain and update the database data model independently of the "traditional" web tier. DB experts can work on the most effective data model without hunting through client source code.It also means that we can use access controls o

matdehaast Dec 6, 2019 View on HN

What’s wrong with stored procedures?

Merad Oct 27, 2019 View on HN

Ive worked on several apps that tried this approach and each of them was a mess. I’ve seen two fundamental problems with building your app on top of stored procs:* Tooling around sql is generally inferior to what’s available for . I’ve yet to see a company with effective automated tests around their database... it’s far more common to have _no_ tests around the database. Even if you’re the unicorn that does have all of that figured out, it still tends to b

nerflad Apr 9, 2025 View on HN

Just put it all in stored procedures. What could go wrong?

paulryanrogers Dec 31, 2024 View on HN

Please don't write a lot of stored procedures. Changing them in large or sharded DBs is not trivial and tooling to support them is minimal.

goto11 Jun 28, 2022 View on HN

Your colleague is dumb. Stored procedures have advantages and disadvantages. For certain data processing operations it is much better to perform everything inside the database than transfer large amount of data back and forth to some external application.But I have also seen organizations with the policy that any operation touching base tables should be encapsulated in a stored procedure. This makes development extremely cumbersome, especially if some DBA is gatekeeper for the stored procedur

gaius Sep 5, 2016 View on HN

Probably because your devs didn't write them in stored procs like they should.

Illniyar Dec 19, 2016 View on HN

Logic in the Database has the following issues:1. it doesn't work well with source control2. deployments, rollback, replication, synchornization - they don't work very well with db procedures3. unless you connect directly to the db, then you must have some logic on the serverside, usually you end up replicating logic from the db to the serverside4. Databases languages (even advanced ones like PL/SQL) are not expressive enough5.It's much easier to scale out the

pmontra Sep 22, 2018 View on HN

I'm not a big fan of PL/SQL. Almost nobody is, so your approach is standard.It's ok if all accesses to the database go through the primary application. Triggers and stored procedures make more sense when a database serves multiple applications possibly in multiple languages. Think of the db as the microservice in front of the data store. Simple stored procedures are no that bad.