If you want to create a procedure, you can use a library, a database stored procedure, or a local Form procedure depending on your needs and system resources.
These different forms of procedures produce different performance results depending on what you are trying to achieve. The database stored procedure will be invoked on the server side and will perform all of the processing there. Server side processing may help reduce network traffic, but may overload the server if too many clients are using these procedures.Local form and library procedures are quite similar in that they are both stored and run on the client with any SQL statements being passed to the server.
The local procedures are typically faster on execution because they are actually part of the .FMX file, but may use more memory and have a longer startup time when the .FMX file is initially invoked.
Library procedures may be better in terms of overall memory as procedures are only loaded into memory in 4K chunks when they are required. The library modules remain separate and compiled (into .PLL or .PLX files). If the code within the library procedures is altered, the form does not require re-generation. If a library contains package global variables, those variables can be shared across forms in a runform session.
Once loaded, they are read from memory without adding to the size of each and every .FMX file. Libraries have the additional advantage that a library can be attached to a number of forms at once.
Think of it like a DLL. The only overhead that's added to the form that attaches a library is that negligible amount required to remember the name of the libraries on which it depends.