May 2017
Beginner
416 pages
10h 37m
English
In many cases, performance is bad because functions are called way too often. I cannot stress this point too much: calling things too often is the main reason for bad performance. When you create a function, you can choose from three types of functions: volatile, stable, and immutable. Here is an example:
test=# SELECT random(), random(); random | random -------------------+------------------- 0.276252629235387 | 0.710661871358752 (1 row) test=# SELECT now(), now(); now | now -------------------------------+------------------------------- 2016-12-16 12:57:17.135751+01 | 2016-12-16 12:57:17.135751+01 (1 row) test=# SELECT pi(); pi ------------------ 3.14159265358979 (1 row)
A volatile function ...
Read now
Unlock full access