forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd06215d
committed
Allow setting statistics target for extended statistics
When building statistics, we need to decide how many rows to sample andhow accurate the resulting statistics should be. Until now, it was notpossible to explicitly define statistics target for extended statisticsobjects, the value was always computed from the per-attribute targetswith a fallback to the system-wide default statistics target.That's a bit inconvenient, as it ties together the statistics target setfor per-column and extended statistics. In some cases it may be usefulto require larger sample / higher accuracy for extended statics (or theother way around), but with this approach that's not possible.So this commit introduces a new command, allowing to specify statisticstarget for individual extended statistics objects, overriding the valuederived from per-attribute targets (and the system default). ALTER STATISTICS stat_name SET STATISTICS target_value;When determining statistics target for an extended statistics object wefirst look at this explicitly set value. When this value is -1, we fallback to the old formula, looking at the per-attribute targets first andthen the system default. This means the behavior is backwards compatiblewith older PostgreSQL releases.Author: Tomas VondraDiscussion:https://postgr.es/m/20190618213357.vli3i23vpkset2xd@developmentReviewed-by: Kirk Jamison, Dean Rasheed1 parentbca6e64 commitd06215d
File tree
22 files changed
+458
-19
lines changed- doc/src/sgml/ref
- src
- backend
- commands
- nodes
- parser
- statistics
- tcop
- bin
- pg_dump
- t
- psql
- include
- catalog
- commands
- nodes
- statistics
- test/regress
- expected
- sql
22 files changed
+458
-19
lines changedLines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
| 29 | + | |
29 | 30 |
| |
30 | 31 |
| |
31 | 32 |
| |
| |||
93 | 94 |
| |
94 | 95 |
| |
95 | 96 |
| |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
96 | 113 |
| |
97 | 114 |
| |
98 | 115 |
| |
|
Lines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
307 | 307 |
| |
308 | 308 |
| |
309 | 309 |
| |
310 |
| - | |
| 310 | + | |
| 311 | + | |
311 | 312 |
| |
312 | 313 |
| |
313 | 314 |
| |
| |||
491 | 492 |
| |
492 | 493 |
| |
493 | 494 |
| |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
494 | 505 |
| |
495 | 506 |
| |
496 | 507 |
| |
|
Lines changed: 108 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
17 | 18 |
| |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
22 | 23 |
| |
23 | 24 |
| |
| 25 | + | |
24 | 26 |
| |
25 | 27 |
| |
26 | 28 |
| |
| |||
29 | 31 |
| |
30 | 32 |
| |
31 | 33 |
| |
| 34 | + | |
32 | 35 |
| |
33 | 36 |
| |
34 | 37 |
| |
| |||
336 | 339 |
| |
337 | 340 |
| |
338 | 341 |
| |
| 342 | + | |
339 | 343 |
| |
340 | 344 |
| |
341 | 345 |
| |
| |||
414 | 418 |
| |
415 | 419 |
| |
416 | 420 |
| |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
417 | 525 |
| |
418 | 526 |
| |
419 | 527 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3497 | 3497 |
| |
3498 | 3498 |
| |
3499 | 3499 |
| |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
| 3503 | + | |
| 3504 | + | |
| 3505 | + | |
| 3506 | + | |
| 3507 | + | |
| 3508 | + | |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
3500 | 3512 |
| |
3501 | 3513 |
| |
3502 | 3514 |
| |
| |||
5211 | 5223 |
| |
5212 | 5224 |
| |
5213 | 5225 |
| |
| 5226 | + | |
| 5227 | + | |
| 5228 | + | |
5214 | 5229 |
| |
5215 | 5230 |
| |
5216 | 5231 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1365 | 1365 |
| |
1366 | 1366 |
| |
1367 | 1367 |
| |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
1368 | 1378 |
| |
1369 | 1379 |
| |
1370 | 1380 |
| |
| |||
3309 | 3319 |
| |
3310 | 3320 |
| |
3311 | 3321 |
| |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
3312 | 3325 |
| |
3313 | 3326 |
| |
3314 | 3327 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2668 | 2668 |
| |
2669 | 2669 |
| |
2670 | 2670 |
| |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
2671 | 2681 |
| |
2672 | 2682 |
| |
2673 | 2683 |
| |
| |||
4130 | 4140 |
| |
4131 | 4141 |
| |
4132 | 4142 |
| |
| 4143 | + | |
| 4144 | + | |
| 4145 | + | |
4133 | 4146 |
| |
4134 | 4147 |
| |
4135 | 4148 |
| |
|
Lines changed: 30 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
252 | 252 |
| |
253 | 253 |
| |
254 | 254 |
| |
255 |
| - | |
| 255 | + | |
256 | 256 |
| |
257 | 257 |
| |
258 | 258 |
| |
| |||
852 | 852 |
| |
853 | 853 |
| |
854 | 854 |
| |
| 855 | + | |
855 | 856 |
| |
856 | 857 |
| |
857 | 858 |
| |
| |||
3984 | 3985 |
| |
3985 | 3986 |
| |
3986 | 3987 |
| |
| 3988 | + | |
| 3989 | + | |
| 3990 | + | |
| 3991 | + | |
| 3992 | + | |
| 3993 | + | |
| 3994 | + | |
| 3995 | + | |
| 3996 | + | |
| 3997 | + | |
| 3998 | + | |
| 3999 | + | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
| 4005 | + | |
| 4006 | + | |
| 4007 | + | |
| 4008 | + | |
| 4009 | + | |
| 4010 | + | |
| 4011 | + | |
| 4012 | + | |
| 4013 | + | |
| 4014 | + | |
| 4015 | + | |
3987 | 4016 |
| |
3988 | 4017 |
| |
3989 | 4018 |
| |
|
0 commit comments
Comments
(0)