- Notifications
You must be signed in to change notification settings - Fork28
Commit11ea45f
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 parent1432349 commit11ea45f
File tree
6 files changed
+177
-64
lines changed- doc/src/sgml
- src
- backend/optimizer
- plan
- util
- test/regress
- expected
- sql
6 files changed
+177
-64
lines changedLines changed: 11 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4410 | 4410 |
| |
4411 | 4411 |
| |
4412 | 4412 |
| |
4413 |
| - | |
4414 |
| - | |
| 4413 | + | |
| 4414 | + | |
4415 | 4415 |
| |
4416 |
| - | |
| 4416 | + | |
| 4417 | + | |
4417 | 4418 |
| |
4418 | 4419 |
| |
4419 | 4420 |
| |
| |||
4437 | 4438 |
| |
4438 | 4439 |
| |
4439 | 4440 |
| |
4440 |
| - | |
| 4441 | + | |
4441 | 4442 |
| |
4442 | 4443 |
| |
4443 |
| - | |
| 4444 | + | |
| 4445 | + | |
| 4446 | + | |
| 4447 | + | |
4444 | 4448 |
| |
4445 | 4449 |
| |
4446 | 4450 |
| |
4447 | 4451 |
| |
4448 |
| - | |
| 4452 | + | |
| 4453 | + | |
4449 | 4454 |
| |
4450 | 4455 |
| |
4451 | 4456 |
| |
|
Lines changed: 5 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3918 | 3918 |
| |
3919 | 3919 |
| |
3920 | 3920 |
| |
3921 |
| - | |
3922 |
| - | |
3923 |
| - | |
3924 |
| - | |
3925 |
| - | |
3926 |
| - | |
3927 |
| - | |
3928 |
| - | |
3929 |
| - | |
3930 |
| - | |
3931 |
| - | |
3932 |
| - | |
3933 |
| - | |
3934 |
| - | |
3935 |
| - | |
3936 |
| - | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
3937 | 3926 |
| |
3938 | 3927 |
| |
3939 | 3928 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1324 | 1324 |
| |
1325 | 1325 |
| |
1326 | 1326 |
| |
1327 |
| - | |
1328 |
| - | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
1329 | 1330 |
| |
1330 | 1331 |
| |
1331 | 1332 |
| |
|
Lines changed: 96 additions & 40 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
66 | 66 |
| |
67 | 67 |
| |
68 | 68 |
| |
69 |
| - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
70 | 72 |
| |
71 | 73 |
| |
72 | 74 |
| |
| |||
1157 | 1159 |
| |
1158 | 1160 |
| |
1159 | 1161 |
| |
1160 |
| - | |
| 1162 | + | |
1161 | 1163 |
| |
1162 | 1164 |
| |
1163 | 1165 |
| |
1164 | 1166 |
| |
1165 | 1167 |
| |
1166 | 1168 |
| |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
1167 | 1172 |
| |
1168 | 1173 |
| |
1169 | 1174 |
| |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1170 | 1178 |
| |
1171 | 1179 |
| |
1172 | 1180 |
| |
1173 | 1181 |
| |
1174 | 1182 |
| |
1175 | 1183 |
| |
1176 | 1184 |
| |
1177 |
| - | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1178 | 1188 |
| |
1179 | 1189 |
| |
1180 | 1190 |
| |
| |||
1198 | 1208 |
| |
1199 | 1209 |
| |
1200 | 1210 |
| |
1201 |
| - | |
| 1211 | + | |
| 1212 | + | |
1202 | 1213 |
| |
1203 | 1214 |
| |
1204 | 1215 |
| |
| 1216 | + | |
| 1217 | + | |
1205 | 1218 |
| |
1206 | 1219 |
| |
1207 | 1220 |
| |
| |||
1266 | 1279 |
| |
1267 | 1280 |
| |
1268 | 1281 |
| |
1269 |
| - | |
1270 |
| - | |
1271 |
| - | |
1272 |
| - | |
1273 |
| - | |
| 1282 | + | |
1274 | 1283 |
| |
1275 |
| - | |
| 1284 | + | |
1276 | 1285 |
| |
1277 | 1286 |
| |
1278 | 1287 |
| |
| |||
1377 | 1386 |
| |
1378 | 1387 |
| |
1379 | 1388 |
| |
1380 |
| - | |
| 1389 | + | |
1381 | 1390 |
| |
1382 | 1391 |
| |
1383 | 1392 |
| |
| |||
1387 | 1396 |
| |
1388 | 1397 |
| |
1389 | 1398 |
| |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1390 | 1402 |
| |
1391 | 1403 |
| |
1392 | 1404 |
| |
| |||
1395 | 1407 |
| |
1396 | 1408 |
| |
1397 | 1409 |
| |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
1398 | 1417 |
| |
1399 | 1418 |
| |
1400 | 1419 |
| |
| |||
1415 | 1434 |
| |
1416 | 1435 |
| |
1417 | 1436 |
| |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1418 | 1448 |
| |
1419 | 1449 |
| |
1420 | 1450 |
| |
| |||
1423 | 1453 |
| |
1424 | 1454 |
| |
1425 | 1455 |
| |
1426 |
| - | |
1427 |
| - | |
1428 |
| - | |
1429 |
| - | |
1430 |
| - | |
1431 |
| - | |
1432 |
| - | |
| 1456 | + | |
| 1457 | + | |
1433 | 1458 |
| |
1434 |
| - | |
| 1459 | + | |
1435 | 1460 |
| |
1436 | 1461 |
| |
1437 | 1462 |
| |
1438 | 1463 |
| |
1439 | 1464 |
| |
1440 | 1465 |
| |
1441 | 1466 |
| |
1442 |
| - | |
1443 |
| - | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
1444 | 1475 |
| |
1445 |
| - | |
1446 |
| - | |
1447 |
| - | |
1448 |
| - | |
1449 |
| - | |
1450 |
| - | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
1451 | 1481 |
| |
1452 | 1482 |
| |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
1453 | 1493 |
| |
1454 | 1494 |
| |
1455 | 1495 |
| |
| |||
1478 | 1518 |
| |
1479 | 1519 |
| |
1480 | 1520 |
| |
1481 |
| - | |
1482 |
| - | |
1483 |
| - | |
1484 |
| - | |
1485 |
| - | |
1486 |
| - | |
1487 |
| - | |
1488 |
| - | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
1489 | 1537 |
| |
1490 |
| - | |
1491 |
| - | |
| 1538 | + | |
1492 | 1539 |
| |
1493 | 1540 |
| |
1494 | 1541 |
| |
1495 |
| - | |
1496 |
| - | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
1497 | 1550 |
| |
1498 |
| - | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
1499 | 1555 |
| |
1500 | 1556 |
| |
1501 | 1557 |
| |
|
Lines changed: 42 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3417 | 3417 |
| |
3418 | 3418 |
| |
3419 | 3419 |
| |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
| 3430 | + | |
| 3431 | + | |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
| 3447 | + | |
| 3448 | + | |
| 3449 | + | |
| 3450 | + | |
| 3451 | + | |
| 3452 | + | |
| 3453 | + | |
| 3454 | + | |
| 3455 | + | |
| 3456 | + | |
| 3457 | + | |
| 3458 | + | |
| 3459 | + | |
| 3460 | + | |
| 3461 | + | |
3420 | 3462 |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
899 | 899 |
| |
900 | 900 |
| |
901 | 901 |
| |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
902 | 922 |
|
0 commit comments
Comments
(0)