Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-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

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.



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

Attachment: contrib-freespacemap.patch
Description: text/plain (22.2 KB)


pgsql-hackers by date

Next:From: Trent ShipleyDate: 2005-10-28 00:23:02
Subject: Re: enums
Previous:From: Michael FuhrDate: 2005-10-27 23:41:01
Subject: Re: enums

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group