- Notifications
You must be signed in to change notification settings - Fork28
Commite03ff73
committed
Clean up handling of constraint_exclusion and enable_partition_pruning.
The interaction of these parameters was a bit confused/confusing,and in fact v11 entirely misses the opportunity to apply partitionconstraints when a partition is accessed directly (rather thanindirectly from its parent).In HEAD, establish the principle that enable_partition_pruning controlspartition pruning and nothing else. When accessing a partition via itsparent, we do partition pruning (if enabled by enable_partition_pruning)and then there is no need to consider partition constraints in theconstraint_exclusion logic. When accessing a partition directly, itspartition constraints are applied by the constraint_exclusion logic,only if constraint_exclusion = on.In v11, we can't have such a clean division of these GUCs' effects,partly because we don't want to break compatibility too much in areleased branch, and partly because the clean coding requiresinheritance_planner to have applied partition pruning to a partitionedtarget table, which it doesn't in v11. However, we can tweak thingsenough to cover the missed case, which seems like a good idea sinceit's potentially a performance regression from v10. This patch keepsv11's previous behavior in which enable_partition_pruning overridesconstraint_exclusion for an inherited target table, though.In HEAD, also teach relation_excluded_by_constraints that it's okay to useinheritable constraints when trying to prune a traditional inheritancetree. This might not be thought worthy of effort given that that featureis semi-deprecated now, but we have enough infrastructure that it onlytakes a couple more lines of code to do it correctly.Amit Langote and Tom LaneDiscussion:https://postgr.es/m/9813f079-f16b-61c8-9ab7-4363cab28d80@lab.ntt.co.jpDiscussion:https://postgr.es/m/29069.1555970894@sss.pgh.pa.us1 parentad23adc commite03ff73
File tree
6 files changed
+156
-67
lines changed- doc/src/sgml
- src
- backend/optimizer
- plan
- util
- test/regress
- expected
- sql
6 files changed
+156
-67
lines changedLines changed: 11 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5084 | 5084 |
| |
5085 | 5085 |
| |
5086 | 5086 |
| |
5087 |
| - | |
5088 |
| - | |
| 5087 | + | |
| 5088 | + | |
5089 | 5089 |
| |
5090 |
| - | |
| 5090 | + | |
| 5091 | + | |
5091 | 5092 |
| |
5092 | 5093 |
| |
5093 | 5094 |
| |
| |||
5111 | 5112 |
| |
5112 | 5113 |
| |
5113 | 5114 |
| |
5114 |
| - | |
| 5115 | + | |
5115 | 5116 |
| |
5116 | 5117 |
| |
5117 |
| - | |
| 5118 | + | |
| 5119 | + | |
| 5120 | + | |
| 5121 | + | |
5118 | 5122 |
| |
5119 | 5123 |
| |
5120 | 5124 |
| |
5121 | 5125 |
| |
5122 |
| - | |
| 5126 | + | |
| 5127 | + | |
5123 | 5128 |
| |
5124 | 5129 |
| |
5125 | 5130 |
| |
|
Lines changed: 2 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4534 | 4534 |
| |
4535 | 4535 |
| |
4536 | 4536 |
| |
4537 |
| - | |
4538 |
| - | |
4539 |
| - | |
4540 |
| - | |
4541 |
| - | |
4542 |
| - | |
4543 |
| - | |
4544 |
| - | |
4545 |
| - | |
4546 | 4537 |
| |
4547 | 4538 |
| |
4548 | 4539 |
| |
4549 | 4540 |
| |
4550 |
| - | |
4551 |
| - | |
4552 |
| - | |
4553 |
| - | |
4554 |
| - | |
4555 |
| - | |
| 4541 | + | |
| 4542 | + | |
4556 | 4543 |
| |
4557 | 4544 |
| |
4558 | 4545 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1513 | 1513 |
| |
1514 | 1514 |
| |
1515 | 1515 |
| |
1516 |
| - | |
1517 |
| - | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
1518 | 1519 |
| |
1519 | 1520 |
| |
1520 | 1521 |
| |
|
Lines changed: 78 additions & 44 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
67 | 67 |
| |
68 | 68 |
| |
69 | 69 |
| |
70 |
| - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 |
| |
72 | 74 |
| |
73 | 75 |
| |
| |||
1134 | 1136 |
| |
1135 | 1137 |
| |
1136 | 1138 |
| |
1137 |
| - | |
| 1139 | + | |
1138 | 1140 |
| |
1139 | 1141 |
| |
1140 | 1142 |
| |
1141 | 1143 |
| |
1142 | 1144 |
| |
1143 | 1145 |
| |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
1144 | 1149 |
| |
1145 | 1150 |
| |
1146 | 1151 |
| |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1147 | 1155 |
| |
1148 | 1156 |
| |
1149 | 1157 |
| |
1150 | 1158 |
| |
1151 | 1159 |
| |
1152 | 1160 |
| |
1153 | 1161 |
| |
1154 |
| - | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1155 | 1165 |
| |
1156 | 1166 |
| |
1157 | 1167 |
| |
| |||
1175 | 1185 |
| |
1176 | 1186 |
| |
1177 | 1187 |
| |
1178 |
| - | |
| 1188 | + | |
| 1189 | + | |
1179 | 1190 |
| |
1180 | 1191 |
| |
1181 | 1192 |
| |
| 1193 | + | |
| 1194 | + | |
1182 | 1195 |
| |
1183 | 1196 |
| |
1184 | 1197 |
| |
| |||
1243 | 1256 |
| |
1244 | 1257 |
| |
1245 | 1258 |
| |
1246 |
| - | |
1247 |
| - | |
1248 |
| - | |
1249 |
| - | |
1250 |
| - | |
| 1259 | + | |
1251 | 1260 |
| |
1252 |
| - | |
| 1261 | + | |
1253 | 1262 |
| |
1254 | 1263 |
| |
1255 | 1264 |
| |
| |||
1366 | 1375 |
| |
1367 | 1376 |
| |
1368 | 1377 |
| |
1369 |
| - | |
| 1378 | + | |
1370 | 1379 |
| |
1371 | 1380 |
| |
1372 | 1381 |
| |
| |||
1376 | 1385 |
| |
1377 | 1386 |
| |
1378 | 1387 |
| |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
1379 | 1391 |
| |
1380 | 1392 |
| |
1381 | 1393 |
| |
| |||
1384 | 1396 |
| |
1385 | 1397 |
| |
1386 | 1398 |
| |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1387 | 1406 |
| |
1388 | 1407 |
| |
1389 | 1408 |
| |
| |||
1410 | 1429 |
| |
1411 | 1430 |
| |
1412 | 1431 |
| |
1413 |
| - | |
1414 |
| - | |
1415 |
| - | |
1416 |
| - | |
1417 |
| - | |
1418 |
| - | |
1419 |
| - | |
1420 |
| - | |
1421 |
| - | |
1422 |
| - | |
1423 |
| - | |
1424 |
| - | |
| 1432 | + | |
1425 | 1433 |
| |
1426 | 1434 |
| |
1427 | 1435 |
| |
1428 | 1436 |
| |
1429 | 1437 |
| |
1430 | 1438 |
| |
1431 |
| - | |
1432 |
| - | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
1433 | 1447 |
| |
1434 |
| - | |
1435 |
| - | |
1436 |
| - | |
1437 |
| - | |
1438 |
| - | |
1439 |
| - | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
1440 | 1453 |
| |
1441 | 1454 |
| |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
1442 | 1467 |
| |
1443 | 1468 |
| |
1444 | 1469 |
| |
| |||
1467 | 1492 |
| |
1468 | 1493 |
| |
1469 | 1494 |
| |
1470 |
| - | |
1471 |
| - | |
1472 |
| - | |
1473 |
| - | |
1474 |
| - | |
1475 |
| - | |
1476 |
| - | |
1477 |
| - | |
| 1495 | + | |
1478 | 1496 |
| |
1479 |
| - | |
1480 |
| - | |
| 1497 | + | |
1481 | 1498 |
| |
1482 | 1499 |
| |
1483 | 1500 |
| |
1484 |
| - | |
1485 |
| - | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
1486 | 1517 |
| |
1487 |
| - | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1488 | 1522 |
| |
1489 | 1523 |
| |
1490 | 1524 |
| |
|
Lines changed: 42 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3639 | 3639 |
| |
3640 | 3640 |
| |
3641 | 3641 |
| |
| 3642 | + | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
| 3655 | + | |
| 3656 | + | |
| 3657 | + | |
| 3658 | + | |
| 3659 | + | |
| 3660 | + | |
| 3661 | + | |
| 3662 | + | |
| 3663 | + | |
| 3664 | + | |
| 3665 | + | |
| 3666 | + | |
| 3667 | + | |
| 3668 | + | |
| 3669 | + | |
| 3670 | + | |
| 3671 | + | |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
| 3675 | + | |
| 3676 | + | |
| 3677 | + | |
| 3678 | + | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
3642 | 3684 |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
990 | 990 |
| |
991 | 991 |
| |
992 | 992 |
| |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
993 | 1013 |
|
0 commit comments
Comments
(0)