- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit440c5ee
committed
Restore the ability to run pl/pgsql expression queries in parallel.
pl/pgsql's notion of an "expression" is very broad, encompassingany SQL SELECT query that returns a single column and no more thanone row. So there are cases, for example evaluation of an aggregatefunction, where the query involves significant work and it'd be usefulto run it with parallel workers. This used to be possible, butcommits3eea7a0 et al unintentionally disabled it.The simplest fix is to make exec_eval_expr() pass maxtuples = 0rather than 2 to exec_run_select(). This avoids the new rule thatwe will never use parallelism when a nonzero "count" limit is passedto ExecutorRun(). (Note that the pre-3eea7a0c9 behavior was indeedunsafe, so reverting that rule is not in the cards.) The reasonfor passing 2 before was that exec_eval_expr() will throw an errorif it gets more than one returned row, so we figured that as soonas we have two rows we know that will happen and we might as wellstop running the query. That choice was cost-free when it was made;but disabling parallelism is far from cost-free, so now passing 2amounts to optimizing a failure case at the expense of useful cases.An expression query that can return more than one row is certainlybroken. People might now need to wait a bit longer to discover suchbreakage; but hopefully few will use enormously expensive cases astheir first test of new pl/pgsql logic.Author: Dipesh Dhameliya <dipeshdhameliya125@gmail.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CABgZEgdfbnq9t6xXJnmXbChNTcWFjeM_6nuig41tm327gYi2ig@mail.gmail.comBackpatch-through: 131 parent8d1071e commit440c5ee
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5703 | 5703 | | |
5704 | 5704 | | |
5705 | 5705 | | |
5706 | | - | |
| 5706 | + | |
5707 | 5707 | | |
5708 | 5708 | | |
5709 | 5709 | | |
| |||
5757 | 5757 | | |
5758 | 5758 | | |
5759 | 5759 | | |
| 5760 | + | |
| 5761 | + | |
| 5762 | + | |
| 5763 | + | |
5760 | 5764 | | |
5761 | 5765 | | |
5762 | 5766 | | |
| |||
0 commit comments
Comments
(0)