forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4e85642
committed
Apply constraint exclusion more generally in partitioning
We were applying constraint exclusion on the partition constraint whengenerating pruning steps for a clause, but only for the ratherrestricted situation of them being boolean OR operators; however it ispossible to have differently shaped clauses that also benefit fromconstraint exclusion. This applies particularly to the defaultpartition since their constraints are in essence a long list of OR'edsubclauses ... but it applies to other cases too. So in certain caseswe're scanning partitions that we don't need to.Remove the specialized code in OR clauses, and add a generallyapplicable test of the clause refuting the partition constraint; markthe whole pruning operation as contradictory if it hits.This has the unwanted side-effect of testing some (most? all?)constraints more than once if constraint_exclusion=on. That seemsunavoidable as far as I can tell without some additional work, butthat's not the recommended setting for that parameter anyway.However, because this imposes additional processing cost for allqueries using partitioned tables, I decided not to backpatch thischange.Author: Amit Langote, Yuzuko Hosoya, Álvaro HerreraReviewers: Shawn Wang, Thibaut Madeleine, Yoshikazu Imai, KyotaroHoriguchi; they were also uncredited reviewers for commit489247b.Discussion:https://postgr.es/m/9bb31dfe-b0d0-53f3-3ea6-e64b811424cf@lab.ntt.co.jp1 parent1f33f21 commit4e85642
File tree
3 files changed
+52
-26
lines changed- src
- backend/partitioning
- test/regress
- expected
- sql
3 files changed
+52
-26
lines changedLines changed: 30 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
849 | 849 |
| |
850 | 850 |
| |
851 | 851 |
| |
852 |
| - | |
853 |
| - | |
854 |
| - | |
855 |
| - | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
856 | 857 |
| |
857 | 858 |
| |
858 | 859 |
| |
| |||
942 | 943 |
| |
943 | 944 |
| |
944 | 945 |
| |
| 946 | + | |
| 947 | + | |
945 | 948 |
| |
946 | 949 |
| |
947 | 950 |
| |
948 | 951 |
| |
949 | 952 |
| |
950 | 953 |
| |
951 |
| - | |
952 |
| - | |
953 |
| - | |
954 |
| - | |
955 |
| - | |
956 |
| - | |
957 | 954 |
| |
958 |
| - | |
959 |
| - | |
960 |
| - | |
961 |
| - | |
962 |
| - | |
963 |
| - | |
964 |
| - | |
965 |
| - | |
966 |
| - | |
967 |
| - | |
968 |
| - | |
969 |
| - | |
970 |
| - | |
971 |
| - | |
972 |
| - | |
973 |
| - | |
974 | 955 |
| |
975 | 956 |
| |
976 | 957 |
| |
| |||
1038 | 1019 |
| |
1039 | 1020 |
| |
1040 | 1021 |
| |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
1041 | 1045 |
| |
1042 | 1046 |
| |
1043 | 1047 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
592 | 592 |
| |
593 | 593 |
| |
594 | 594 |
| |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
595 | 613 |
| |
596 | 614 |
| |
597 | 615 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
88 | 92 |
| |
89 | 93 |
| |
90 | 94 |
| |
|
0 commit comments
Comments
(0)