- Notifications
You must be signed in to change notification settings - Fork5.1k
Commit684a745
committed
pgstattuple: Improve reports generated for indexes (hash, gist, btree)
pgstattuple checks the state of the pages retrieved for gist and hashusing some check functions from each index AM, respectivelygistcheckpage() and _hash_checkpage(). When these are called, theywould fail when bumping on data that is found as incorrect (like opaquearea size not matching, or empty pages), contrary to btree that simplydiscards these cases and continues to aggregate data.Zero pages can happen after a crash, with these AMs being able to do aninternal cleanup when these are seen. Also, sporadic failures areannoying when doing for example a large-scale diagnostic query based onpgstattuple with a join of pg_class, as it forces one to use tricks likequals to discard hash or gist indexes, or use a PL wrapper able to catcherrors.This commit changes the reports generated for btree, gist and hash tobe more user-friendly;- When seeing an empty page, report it as free space. This new ruleapplies to gist and hash, and already applied to btree.- For btree, a check based on the size of BTPageOpaqueData is added.- For gist indexes, gistcheckpage() is not called anymore, replaced by acheck based on the size of GISTPageOpaqueData.- For hash indexes, instead of _hash_getbuf_with_strategy(), use adirect call to ReadBufferExtended(), coupled with a check based onHashPageOpaqueData. The opaque area size check was already used.- Pages that do not match these criterias are discarded from the statsreports generated.There have been a couple of bug reports over the years that complainedabout the current behavior for hash and gist, as being not that useful,with nothing being done about it. Hence this change is backpatched downto v13.Reported-by: Noah Misch <noah@leadboat.com>Author: Nitin Motiani <nitinmotiani@google.com>Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>Discussion:https://postgr.es/m/CAH5HC95gT1J3dRYK4qEnaywG8RqjbwDdt04wuj8p39R=HukayA@mail.gmail.comBackpatch-through: 131 parentfd726b8 commit684a745
1 file changed
+22
-10
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
424 | 424 |
| |
425 | 425 |
| |
426 | 426 |
| |
427 |
| - | |
| 427 | + | |
428 | 428 |
| |
429 | 429 |
| |
430 | 430 |
| |
| |||
458 | 458 |
| |
459 | 459 |
| |
460 | 460 |
| |
461 |
| - | |
| 461 | + | |
| 462 | + | |
462 | 463 |
| |
463 | 464 |
| |
464 |
| - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
465 | 471 |
| |
466 | 472 |
| |
467 | 473 |
| |
| |||
502 | 508 |
| |
503 | 509 |
| |
504 | 510 |
| |
505 |
| - | |
506 | 511 |
| |
507 |
| - | |
508 |
| - | |
| 512 | + | |
509 | 513 |
| |
510 |
| - | |
511 |
| - | |
| 514 | + | |
| 515 | + | |
512 | 516 |
| |
513 |
| - | |
| 517 | + | |
514 | 518 |
| |
515 |
| - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
516 | 528 |
| |
517 | 529 |
| |
518 | 530 |
| |
|
0 commit comments
Comments
(0)