forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6c7251d
committed
Implement new optimization rule for updates of expanded variables.
If a read/write expanded variable is declared locally to theassignment statement that is updating it, and it is referencedexactly once in the assignment RHS, then we can optimize theoperation as a direct update of the expanded value, whetheror not the function(s) operating on it can be trusted not tomodify the value before throwing an error. This works becauseif an error does get thrown, we no longer care what value thevariable has.In cases where that doesn't work, fall back to the previousrule that checks for safety of the top-level function.In any case, postpone determination of whether these optimizationsare feasible until we are executing a Param referencing the targetvariable and that variable holds a R/W expanded object. While theprevious incarnation of exec_check_rw_parameter was pretty cheap,this is a bit less so, and our plan to invoke support functionswill make it even less so. So avoiding the check for variableswhere it couldn't be useful should be a win.Author: Tom Lane <tgl@sss.pgh.pa.us>Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>Discussion:https://postgr.es/m/CACxu=vJaKFNsYxooSnW1wEgsAO5u_v1XYBacfVJ14wgJV_PYeg@mail.gmail.com1 parent36fb9ef commit6c7251d
File tree
6 files changed
+364
-62
lines changed- src
- include/executor
- pl/plpgsql/src
- expected
- sql
- tools/pgindent
6 files changed
+364
-62
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
425 | 425 |
| |
426 | 426 |
| |
427 | 427 |
| |
| 428 | + | |
428 | 429 |
| |
429 | 430 |
| |
430 | 431 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
55 | 64 |
| |
56 | 65 |
| |
57 | 66 |
| |
|
0 commit comments
Comments
(0)