Creating Custom Functions
PostgreSQL includes a number of predefined functions to help in data manipulation (see Chapter 4, “PostgreSQL Functions,” for a full listing). Many of the ones included are general-purpose functions that aid in converting, formatting, or aggregating data.
There are many cases in which the system would benefit from the existence of user-defined functions. Functions are particularly useful when the same information needs to be accessed repeatedly. In these cases, it is possible to create a user-defined function that is stored within the server.
Typically, when a function is created, a query plan is precompiled and stored as ready to be executed. This benefits system speed tremendously because the client application only ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access