forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfae535d
committed
Teach Append to consider tuple_fraction when accumulating subpaths.
This change is dedicated to more active usage of IndexScan and parameterizedNestLoop paths in partitioned cases under an Append node, as it already workswith plain tables. As newly added regression tests demonstrate, it shouldprovide more smartness to the partitionwise technique.With an indication of how many tuples are needed, it may be more meaningfulto use the 'fractional branch' subpaths of the Append path list, which aremore optimal for this specific number of tuples. Planning on a higher level,if the optimizer needs all the tuples, it will choose non-fractional paths.In the case when, during execution, Append needs to return fewer tuples thandeclared by tuple_fraction, it would not be harmful to use the 'intermediate'variant of paths. However, it will earn a considerable profit if a sensibleset of tuples is selected.The change of the existing regression test demonstrates the positive outcomeof this feature: instead of scanning the whole table, the optimizer prefersto use a parameterized scan, being aware of the only single tuple the joinhas to produce to perform the query.Discussion:https://www.postgresql.org/message-id/flat/CAN-LCVPxnWB39CUBTgOQ9O7Dd8DrA_tpT1EY3LNVnUuvAX1NjA%40mail.gmail.comAuthor: Nikita Malakhov <hukutoc@gmail.com>Author: Andrei Lepikhov <lepihov@gmail.com>Reviewed-by: Andy Fan <zhihuifan1213@163.com>Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>1 parentb83e8a2 commitfae535d
File tree
5 files changed
+168
-10
lines changed- src
- backend/optimizer
- path
- plan
- test/regress
- expected
- sql
5 files changed
+168
-10
lines changedLines changed: 16 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1371 | 1371 |
| |
1372 | 1372 |
| |
1373 | 1373 |
| |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
1374 | 1388 |
| |
1375 |
| - | |
1376 |
| - | |
| 1389 | + | |
| 1390 | + | |
1377 | 1391 |
| |
1378 | 1392 |
| |
1379 | 1393 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6414 | 6414 |
| |
6415 | 6415 |
| |
6416 | 6416 |
| |
| 6417 | + | |
| 6418 | + | |
| 6419 | + | |
| 6420 | + | |
| 6421 | + | |
6417 | 6422 |
| |
6418 | 6423 |
| |
6419 | 6424 |
| |
| |||
6436 | 6441 |
| |
6437 | 6442 |
| |
6438 | 6443 |
| |
| 6444 | + | |
| 6445 | + | |
| 6446 | + | |
6439 | 6447 |
| |
6440 | 6448 |
| |
6441 | 6449 |
| |
|
Lines changed: 116 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5260 | 5260 |
| |
5261 | 5261 |
| |
5262 | 5262 |
| |
| 5263 | + | |
| 5264 | + | |
| 5265 | + | |
| 5266 | + | |
| 5267 | + | |
| 5268 | + | |
| 5269 | + | |
| 5270 | + | |
| 5271 | + | |
| 5272 | + | |
| 5273 | + | |
| 5274 | + | |
| 5275 | + | |
| 5276 | + | |
| 5277 | + | |
| 5278 | + | |
| 5279 | + | |
| 5280 | + | |
| 5281 | + | |
| 5282 | + | |
| 5283 | + | |
| 5284 | + | |
| 5285 | + | |
| 5286 | + | |
| 5287 | + | |
| 5288 | + | |
| 5289 | + | |
| 5290 | + | |
| 5291 | + | |
| 5292 | + | |
| 5293 | + | |
| 5294 | + | |
| 5295 | + | |
| 5296 | + | |
| 5297 | + | |
| 5298 | + | |
| 5299 | + | |
| 5300 | + | |
| 5301 | + | |
| 5302 | + | |
| 5303 | + | |
| 5304 | + | |
| 5305 | + | |
| 5306 | + | |
| 5307 | + | |
| 5308 | + | |
| 5309 | + | |
| 5310 | + | |
| 5311 | + | |
| 5312 | + | |
| 5313 | + | |
| 5314 | + | |
| 5315 | + | |
| 5316 | + | |
| 5317 | + | |
| 5318 | + | |
| 5319 | + | |
| 5320 | + | |
| 5321 | + | |
| 5322 | + | |
| 5323 | + | |
| 5324 | + | |
| 5325 | + | |
| 5326 | + | |
| 5327 | + | |
| 5328 | + | |
| 5329 | + | |
| 5330 | + | |
| 5331 | + | |
| 5332 | + | |
| 5333 | + | |
| 5334 | + | |
| 5335 | + | |
| 5336 | + | |
| 5337 | + | |
| 5338 | + | |
| 5339 | + | |
| 5340 | + | |
| 5341 | + | |
| 5342 | + | |
| 5343 | + | |
| 5344 | + | |
| 5345 | + | |
| 5346 | + | |
| 5347 | + | |
| 5348 | + | |
| 5349 | + | |
| 5350 | + | |
| 5351 | + | |
| 5352 | + | |
| 5353 | + | |
| 5354 | + | |
| 5355 | + | |
| 5356 | + | |
| 5357 | + | |
| 5358 | + | |
| 5359 | + | |
| 5360 | + | |
| 5361 | + | |
| 5362 | + | |
| 5363 | + | |
| 5364 | + | |
| 5365 | + | |
| 5366 | + | |
| 5367 | + | |
| 5368 | + | |
| 5369 | + | |
| 5370 | + | |
| 5371 | + | |
| 5372 | + | |
| 5373 | + | |
| 5374 | + | |
| 5375 | + | |
| 5376 | + | |
| 5377 | + | |
| 5378 | + | |
5263 | 5379 |
| |
5264 | 5380 |
| |
5265 | 5381 |
| |
|
Lines changed: 7 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1472 | 1472 |
| |
1473 | 1473 |
| |
1474 | 1474 |
| |
1475 |
| - | |
1476 |
| - | |
| 1475 | + | |
| 1476 | + | |
1477 | 1477 |
| |
1478 | 1478 |
| |
1479 | 1479 |
| |
1480 |
| - | |
1481 |
| - | |
1482 |
| - | |
1483 |
| - | |
1484 |
| - | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
1485 | 1484 |
| |
1486 |
| - | |
| 1485 | + | |
1487 | 1486 |
| |
1488 | 1487 |
| |
1489 | 1488 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1225 | 1225 |
| |
1226 | 1226 |
| |
1227 | 1227 |
| |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
1228 | 1249 |
| |
1229 | 1250 |
| |
1230 | 1251 |
| |
|
0 commit comments
Comments
(0)