TODO Item - Add system view to show free space map contents

From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: pgsql-patches(at)postgresql(dot)org
Subject: TODO Item - Add system view to show free space map contents
Date: 2005-10-28 00:21:50
Message-ID: 43616F1E.7050805@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

This patch implements a view to display the free space map contents - e.g :

regression=# SELECT c.relname, m.relblocknumber, m.blockfreebytes
FROM pg_freespacemap m INNER JOIN pg_class c
ON c.relfilenode = m.relfilenode LIMIT 10;
relname | relblocknumber | blockfreebytes
------------------------+----------------+----------------
sql_features | 5 | 2696
sql_implementation_info | 0 | 7104
sql_languages | 0 | 8016
sql_packages | 0 | 7376
sql_sizing | 0 | 6032
pg_authid | 0 | 7424
pg_toast_2618 | 13 | 4588
pg_toast_2618 | 12 | 1680
pg_toast_2618 | 10 | 1436
pg_toast_2618 | 7 | 1136
(10 rows)

[I found being able to display the FSM pretty cool, even if I say so
myself....].

It is written as a contrib module (similar to pg_buffercache) so as to
make any revisions non-initdb requiring.

The code needs to know about several of the (currently) internal data
structures in freespace.c, so I moved these into freespace.h. Similarly
for the handy macros to actually compute the free space. Let me know if
this was the wrong way to proceed!

Additionally access to the FSM pointer itself is required, I added a
function in freespace.c to return this, rather than making it globally
visible, again if the latter is a better approach, it is easily changed.

cheers

Mark

P.s : Currently don't have access to a windows box, so had to just 'take
a stab' at what DLLIMPORTs were required.

Attachment Content-Type Size
contrib-freespacemap.patch text/plain 22.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Trent Shipley 2005-10-28 00:23:02 Re: enums
Previous Message Michael Fuhr 2005-10-27 23:41:01 Re: enums

Browse pgsql-patches by date

  From Date Subject
Next Message Jim C. Nasby 2005-10-28 01:37:22 Re: TODO Item - Add system view to show free space map contents
Previous Message Qingqing Zhou 2005-10-27 19:53:56 Re: A script to make some bug report easier