pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: daniel_adeniji@hotmail.com
Subject: BUG #15950: pg_freespace.avail is 0
Date: Mon, 12 Aug 2019 18:07:31 +0000
Message-ID: <15950-281706ee6094aa6c@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15950
Logged by:          Daniel Adeniji
Email address:      daniel_adeniji@hotmail.com
PostgreSQL version: 11.4
Operating system:   Windows 10
Description:        

Issued the query pasted below :-
===============================

with cteSetting
(
      name
    , setting
)

as
(
    select 
              name
            , setting::integer
            
    from   pg_catalog.pg_settings
    
    where  name = 'block_size'
)
SELECT 

          tblN.nspname 
            as "schema"

		, tblC.relname

        , avg(tblC.relpages)::int
            as relpages

        , avg(tblC.reltuples)::int
            as reltuples

        , count(*) as cnt

        , pg_size_pretty
            (
                cast
                (
                    avg(tblPGFS.avail) as bigint
                )
            ) 
            as "Av. freespace size"

        /*
             max(cteSBS.setting)
            as "blockSize"
        */
        
        , round
            (
                100 
                    * avg
                    (
                        tblPGFS.avail
                    )
                    /
                    ( 
                        avg(cteSBS.setting)::int
                    )
                ,2
            ) as "Av. freespace ratio"		

FROM pg_catalog.pg_class tblC

join pg_catalog.pg_namespace tblN

    on tblC.relnamespace = tblN.oid

inner join pg_freespace(tblC.oid) tblPGFS

    on TRUE

inner join cteSetting cteSBS
    on cteSBS.name = 'block_size'

where   tblC.relkind = 'r'

and     tblN.nspname not in

            (
                  'information_schema'
                , 'pg_catalog'

            )

GROUP BY

          tblN.nspname 

        , tblC.relname

ORDER BY

          tblN.nspname 

        , tblC.relname

;


Result :-
=========

1) pg_freespace.avail is 0



view thread (3+ messages)  latest in thread

Message-ID: <15950-281706ee6094aa6c@postgresql.org>
Permalink:  ../15950-281706ee6094aa6c@postgresql.org/
Also on:    postgresql.org/message-id/15950-281706ee6094aa6c@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, daniel_adeniji@hotmail.com
  Subject: Re: BUG #15950: pg_freespace.avail is 0
  In-Reply-To: <15950-281706ee6094aa6c@postgresql.org>
  References: <15950-281706ee6094aa6c@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox