Speed up plpgsql trigger startup by introducing "promises".
Tom Lane <tgl@sss.pgh.pa.us>
Speed up plpgsql trigger startup by introducing "promises". Over the years we've accreted quite a few special variables that are predefined in plpgsql trigger functions. The cost of initializing these variables to their defined values turns out to be a significant part of the runtime of simple triggers; but, undoubtedly, most real-world triggers never examine the values of most of these variables. To improve matters, invent the notion of a variable that has a "promise" attached to it, specifying which of the predetermined values should be assigned to the variable if anything ever reads it. This eliminates all the unneeded startup overhead, in return for a small penalty on accesses to these variables. Tom Lane, reviewed by Pavel Stehule Discussion: https://postgr.es/m/11986.1514407114@sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/pl/plpgsql/src/pl_comp.c | modified | +38 −12 |
| src/pl/plpgsql/src/pl_exec.c | modified | +219 −115 |
| src/pl/plpgsql/src/pl_funcs.c | modified | +5 −0 |
| src/pl/plpgsql/src/pl_gram.y | modified | +3 −0 |
| src/pl/plpgsql/src/plpgsql.h | modified | +41 −15 |
Discussion
- plpgsql function startup-time improvements 9 messages · 2017-12-27 → 2018-01-25