forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7643bed
committed
When using extended-query protocol, postpone planning of unnamed statements
until Bind is received, so that actual parameter values are visible to theplanner. Make use of the parameter values for estimation purposes (butdon't fold them into the actual plan). This buys back most of thepotential loss of plan quality that ensues from using out-of-lineparameters instead of putting literal values right into the query text.This patch creates a notion of constant-folding expressions 'forestimation purposes only', in which case we can be more aggressive thanthe normal eval_const_expressions() logic can be. Right now the onlydifference in behavior is inserting bound values for Params, but it willbe interesting to look at other possibilities. One that we've seencome up repeatedly is reducing now() and related functions to currentvalues, so that queries like ... WHERE timestampcol > now() - '1 day'have some chance of being planned effectively.Oliver Jowett, with some kibitzing from Tom Lane.1 parent5fe8c7d commit7643bed
File tree
14 files changed
+270
-79
lines changed- doc/src/sgml
- src
- backend
- commands
- executor
- optimizer
- path
- plan
- util
- tcop
- utils/adt
- include
- optimizer
- tcop
14 files changed
+270
-79
lines changedLines changed: 41 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
684 | 684 |
| |
685 | 685 |
| |
686 | 686 |
| |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
687 | 727 |
| |
688 | 728 |
| |
689 | 729 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
176 | 176 |
| |
177 | 177 |
| |
178 | 178 |
| |
179 |
| - | |
| 179 | + | |
180 | 180 |
| |
181 | 181 |
| |
182 | 182 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 |
| - | |
| 17 | + | |
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| |||
84 | 84 |
| |
85 | 85 |
| |
86 | 86 |
| |
87 |
| - | |
| 87 | + | |
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
94 |
| - | |
| 94 | + | |
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
100 | 100 |
| |
101 | 101 |
| |
102 | 102 |
| |
103 |
| - | |
| 103 | + | |
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
1125 | 1125 |
| |
1126 | 1126 |
| |
1127 | 1127 |
| |
1128 |
| - | |
| 1128 | + | |
1129 | 1129 |
| |
1130 | 1130 |
| |
1131 | 1131 |
| |
|
Lines changed: 17 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
487 | 487 |
| |
488 | 488 |
| |
489 | 489 |
| |
490 |
| - | |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 |
| - | |
495 | 490 |
| |
496 | 491 |
| |
497 | 492 |
| |
498 | 493 |
| |
499 | 494 |
| |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
500 | 511 |
| |
501 | 512 |
| |
502 | 513 |
| |
|
Lines changed: 14 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
| 46 | + | |
| 47 | + | |
| 48 | + | |
46 | 49 |
| |
47 | 50 |
| |
48 | 51 |
| |
| |||
71 | 74 |
| |
72 | 75 |
| |
73 | 76 |
| |
74 |
| - | |
| 77 | + | |
| 78 | + | |
75 | 79 |
| |
76 | 80 |
| |
77 | 81 |
| |
78 | 82 |
| |
79 | 83 |
| |
| 84 | + | |
80 | 85 |
| |
81 | 86 |
| |
82 | 87 |
| |
83 | 88 |
| |
84 | 89 |
| |
85 | 90 |
| |
86 |
| - | |
87 |
| - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
88 | 95 |
| |
89 | 96 |
| |
90 | 97 |
| |
| |||
93 | 100 |
| |
94 | 101 |
| |
95 | 102 |
| |
| 103 | + | |
96 | 104 |
| |
97 | 105 |
| |
98 | 106 |
| |
99 | 107 |
| |
| 108 | + | |
100 | 109 |
| |
101 | 110 |
| |
102 | 111 |
| |
| |||
139 | 148 |
| |
140 | 149 |
| |
141 | 150 |
| |
| 151 | + | |
142 | 152 |
| |
143 | 153 |
| |
144 | 154 |
| |
|
0 commit comments
Comments
(0)