forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitde239d0
committed
Consistently use PageGetExactFreeSpace() in pgstattuple.
Previously this code used PageGetHeapFreeSpace on heap pages,and usually used PageGetFreeSpace on index pages (though for somereason GetHashPageStats used PageGetExactFreeSpace instead).The difference is that those functions subtract off the size ofa line pointer, and PageGetHeapFreeSpace has some additionalrules about returning zero if adding another line pointer wouldrequire exceeding MaxHeapTuplesPerPage. Those things make sensewhen testing to see if a new tuple can be put on the page, butthey seem pretty strange for pure statistics collection.Additionally, statapprox_heap had a special rule about countinga "new" page as being fully available space. This also seemsstrange, because it's not actually usable until VACUUM or somesuch process initializes the page. Moreover, it's inconsistentwith what pgstat_heap does, which is to count such a page ashaving zero free space. So make it work like pgstat_heap, whichas of this patch unconditionally calls PageGetExactFreeSpace.This is more of a definitional change than a bug fix, so noback-patch. The module's documentation doesn't define exactlywhat "free space" means either, so we left that as-is.Frédéric Yhuel, reviewed by Rafia Sabih and Andreas Karlsson.Discussion:https://postgr.es/m/3a18f843-76f6-4a84-8cca-49537fefa15d@dalibo.com1 parent218527d commitde239d0
File tree
3 files changed
+5
-12
lines changed- contrib/pgstattuple
3 files changed
+5
-12
lines changedLines changed: 1 addition & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
106 | 106 |
| |
107 | 107 |
| |
108 | 108 |
| |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
| 109 | + | |
117 | 110 |
| |
118 | 111 |
| |
119 | 112 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
311 | 311 |
| |
312 | 312 |
| |
313 | 313 |
| |
314 |
| - | |
| 314 | + | |
315 | 315 |
| |
316 | 316 |
| |
317 | 317 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
372 | 372 |
| |
373 | 373 |
| |
374 | 374 |
| |
375 |
| - | |
| 375 | + | |
376 | 376 |
| |
377 | 377 |
| |
378 | 378 |
| |
| |||
385 | 385 |
| |
386 | 386 |
| |
387 | 387 |
| |
388 |
| - | |
| 388 | + | |
389 | 389 |
| |
390 | 390 |
| |
391 | 391 |
| |
| |||
565 | 565 |
| |
566 | 566 |
| |
567 | 567 |
| |
568 |
| - | |
| 568 | + | |
569 | 569 |
| |
570 | 570 |
| |
571 | 571 |
| |
|
0 commit comments
Comments
(0)