Databases
Stored procedure
A named block of SQL (or procedural code) stored in the database and executed on the server, avoiding the round-trip cost of sending each statement from the application.
Stored procedures centralise logic in the database, which can improve performance but couples the application to a specific engine and makes version control harder. Functions differ from procedures in that functions return a value and can be used inside queries, while procedures are called independently. In PostgreSQL the distinction is formal since version 11 (CREATE PROCEDURE with transaction control); in SQL Server and MySQL it has always existed.