forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit269b532
committed
Add stxdinherit flag to pg_statistic_ext_data
Add pg_statistic_ext_data.stxdinherit flag, so that for each extendedstatistics definition we can store two versions of data - one for therelation alone, one for the whole inheritance tree. This is analogous topg_statistic.stainherit, but we failed to include such flag in catalogsfor extended statistics, and we had to work around it (see commits859b300,36c4bc6 and20b9fa3).This changes the relationship between the two catalogs storing extendedstatistics objects (pg_statistic_ext and pg_statistic_ext_data). Untilnow, there was a simple 1:1 mapping - for each definition there was onepg_statistic_ext_data row, and this row was inserted while creating thestatistics (and then updated during ANALYZE). With the stxdinherit flag,we don't know how many rows there will be (child relations may be addedafter the statistics object is defined), so there may be up to two rows.We could make CREATE STATISTICS to always create both rows, but thatseems wasteful - without partitioning we only need stxdinherit=falserows, and declaratively partitioned tables need only stxdinherit=true.So we no longer initialize pg_statistic_ext_data in CREATE STATISTICS,and instead make that a responsibility of ANALYZE. Which is what we dofor regular statistics too.Patch by me, with extensive improvements and fixes by Justin Pryzby.Author: Tomas Vondra, Justin PryzbyReviewed-by: Tomas Vondra, Justin PryzbyDiscussion:https://postgr.es/m/20210923212624.GI831%40telsasoft.com1 parente701bdd commit269b532
File tree
19 files changed
+252
-237
lines changed- doc/src/sgml
- src
- backend
- catalog
- commands
- optimizer/util
- statistics
- utils
- adt
- cache
- include
- catalog
- commands
- nodes
- statistics
- test/regress
- expected
- sql
19 files changed
+252
-237
lines changedLines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7521 | 7521 |
| |
7522 | 7522 |
| |
7523 | 7523 |
| |
| 7524 | + | |
| 7525 | + | |
| 7526 | + | |
| 7527 | + | |
| 7528 | + | |
| 7529 | + | |
| 7530 | + | |
| 7531 | + | |
| 7532 | + | |
| 7533 | + | |
| 7534 | + | |
| 7535 | + | |
| 7536 | + | |
7524 | 7537 |
| |
7525 | 7538 |
| |
7526 | 7539 |
| |
| |||
7560 | 7573 |
| |
7561 | 7574 |
| |
7562 | 7575 |
| |
| 7576 | + | |
| 7577 | + | |
| 7578 | + | |
| 7579 | + | |
| 7580 | + | |
| 7581 | + | |
| 7582 | + | |
| 7583 | + | |
| 7584 | + | |
| 7585 | + | |
7563 | 7586 |
| |
7564 | 7587 |
| |
7565 | 7588 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
266 | 266 |
| |
267 | 267 |
| |
268 | 268 |
| |
| 269 | + | |
269 | 270 |
| |
270 | 271 |
| |
271 | 272 |
| |
| |||
298 | 299 |
| |
299 | 300 |
| |
300 | 301 |
| |
| 302 | + | |
301 | 303 |
| |
302 | 304 |
| |
303 | 305 |
| |
|
Lines changed: 3 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
549 | 549 |
| |
550 | 550 |
| |
551 | 551 |
| |
552 |
| - | |
553 | 552 |
| |
554 | 553 |
| |
555 | 554 |
| |
| |||
613 | 612 |
| |
614 | 613 |
| |
615 | 614 |
| |
616 |
| - | |
617 |
| - | |
618 |
| - | |
619 |
| - | |
620 |
| - | |
621 |
| - | |
622 |
| - | |
623 |
| - | |
624 |
| - | |
625 |
| - | |
626 |
| - | |
627 |
| - | |
628 |
| - | |
629 |
| - | |
630 |
| - | |
631 |
| - | |
632 |
| - | |
633 |
| - | |
634 |
| - | |
635 |
| - | |
636 |
| - | |
637 |
| - | |
638 |
| - | |
639 |
| - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
640 | 618 |
| |
641 | 619 |
| |
642 | 620 |
| |
|
Lines changed: 34 additions & 38 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
75 | 75 |
| |
76 | 76 |
| |
77 | 77 |
| |
78 |
| - | |
79 |
| - | |
80 | 78 |
| |
81 | 79 |
| |
82 | 80 |
| |
83 | 81 |
| |
84 |
| - | |
85 | 82 |
| |
86 | 83 |
| |
87 | 84 |
| |
| |||
514 | 511 |
| |
515 | 512 |
| |
516 | 513 |
| |
517 |
| - | |
518 |
| - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
519 | 517 |
| |
520 |
| - | |
521 |
| - | |
522 |
| - | |
523 |
| - | |
524 |
| - | |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 |
| - | |
529 |
| - | |
530 |
| - | |
531 |
| - | |
532 |
| - | |
533 |
| - | |
534 |
| - | |
535 |
| - | |
536 |
| - | |
537 |
| - | |
538 |
| - | |
539 | 518 |
| |
540 | 519 |
| |
541 | 520 |
| |
| |||
717 | 696 |
| |
718 | 697 |
| |
719 | 698 |
| |
720 |
| - | |
| 699 | + | |
| 700 | + | |
721 | 701 |
| |
722 | 702 |
| |
723 |
| - | |
| 703 | + | |
724 | 704 |
| |
725 | 705 |
| |
726 | 706 |
| |
727 |
| - | |
728 |
| - | |
729 | 707 |
| |
730 |
| - | |
731 |
| - | |
732 |
| - | |
733 |
| - | |
734 | 708 |
| |
735 | 709 |
| |
736 |
| - | |
737 |
| - | |
738 |
| - | |
739 |
| - | |
| 710 | + | |
| 711 | + | |
740 | 712 |
| |
741 |
| - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
742 | 717 |
| |
743 |
| - | |
| 718 | + | |
| 719 | + | |
744 | 720 |
| |
745 | 721 |
| |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
746 | 742 |
| |
747 | 743 |
| |
748 | 744 |
| |
|
Lines changed: 90 additions & 56 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| 33 | + | |
33 | 34 |
| |
34 | 35 |
| |
35 | 36 |
| |
| |||
1276 | 1277 |
| |
1277 | 1278 |
| |
1278 | 1279 |
| |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
1279 | 1361 |
| |
1280 | 1362 |
| |
1281 | 1363 |
| |
| |||
1299 | 1381 |
| |
1300 | 1382 |
| |
1301 | 1383 |
| |
1302 |
| - | |
1303 | 1384 |
| |
1304 | 1385 |
| |
1305 | 1386 |
| |
| |||
1309 | 1390 |
| |
1310 | 1391 |
| |
1311 | 1392 |
| |
1312 |
| - | |
1313 |
| - | |
1314 |
| - | |
1315 |
| - | |
1316 | 1393 |
| |
1317 | 1394 |
| |
1318 | 1395 |
| |
| |||
1324 | 1401 |
| |
1325 | 1402 |
| |
1326 | 1403 |
| |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
1327 | 1409 |
| |
1328 | 1410 |
| |
1329 | 1411 |
| |
| |||
1364 | 1446 |
| |
1365 | 1447 |
| |
1366 | 1448 |
| |
1367 |
| - | |
1368 |
| - | |
1369 |
| - | |
1370 |
| - | |
1371 |
| - | |
1372 |
| - | |
1373 |
| - | |
1374 |
| - | |
1375 |
| - | |
1376 |
| - | |
1377 |
| - | |
1378 |
| - | |
1379 |
| - | |
1380 |
| - | |
1381 |
| - | |
1382 |
| - | |
1383 |
| - | |
| 1449 | + | |
1384 | 1450 |
| |
1385 |
| - | |
1386 |
| - | |
1387 |
| - | |
1388 |
| - | |
1389 |
| - | |
| 1451 | + | |
1390 | 1452 |
| |
1391 |
| - | |
1392 |
| - | |
1393 |
| - | |
1394 |
| - | |
1395 |
| - | |
1396 |
| - | |
1397 |
| - | |
1398 |
| - | |
1399 |
| - | |
1400 |
| - | |
1401 |
| - | |
1402 |
| - | |
1403 |
| - | |
1404 |
| - | |
1405 |
| - | |
1406 |
| - | |
1407 |
| - | |
1408 |
| - | |
1409 |
| - | |
1410 |
| - | |
1411 |
| - | |
1412 |
| - | |
1413 |
| - | |
1414 |
| - | |
1415 |
| - | |
1416 |
| - | |
1417 |
| - | |
1418 |
| - | |
| 1453 | + | |
1419 | 1454 |
| |
1420 | 1455 |
| |
1421 |
| - | |
1422 | 1456 |
| |
1423 | 1457 |
| |
1424 | 1458 |
| |
|
0 commit comments
Comments
(0)