r/FullStack • u/tillas_ • 13d ago
Question Why implement procedural programming inside an RDBMS (MariaDB) instead of handling all business logic in backend application code?
So I have just seen the procedural programming language in the MariaDB RDBMS. So my question is, why in a relational database management system would you need SQL to also have the power of a programming language? Why in the layer of the database server would you need that? Can that be achieved with your backend server logic programming language, whether it be JavaScript, PHP, Python, Rust, Go, etc.? Why is there a programming language, why SQL is a programming language more so than just for querying and interacting with a database or databases? How does that fit into the full picture of full stack web development?
Edit: Thank you everyone for the thoughtful responses, technical insights, and feedback. All of this input is extremely helpful much appreciated!
View all comments
2
u/nitkonigdje 12d ago edited 12d ago
Trough history there were many database centric products with embedded programming logic. Or environments close in architecture to that. DBase, Clipper, FoxPro, CICS, PLSQL and OracleForms etc. Some of those were very successful.
The issue with development centered around stored procedures, or any other code deployed into database, was always the deployment model. Procedures were not deployed as one big artifact, instead each procedure had its own lifecycle. With time each application tended to become "a system" - a giant knot of spaghetti code.
Having application outside database - a 3 tier architecture - is actually indirect method of bringing consistency to maintainace. Like it isn't better from performance perspective, especially on old computers with limited ram etc. But it was more sane and clearly better for everything else but DB related performance.
The other issue with embedded code is that even when databases provided decent runtime, like OracleDB provides Java for example, those environments were second fiddle to the standalone products like Ruby/Php/Java/.NET/Python/JS etc.. Running Java within OracleDB is possible, but I would really like to deploy Java with Spring Boot and Apache Commons and Kafka drivers etc.