[GENERAL] Function to return per-column counts? - Mailing list pgsql-general

From Seamus Abshere
Subject [GENERAL] Function to return per-column counts?
Date
Msg-id 1506609299.1312748.1121344704.08A3A454@webmail.messagingengine.com
Whole thread Raw
Responses Re: [GENERAL] Function to return per-column counts?  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-general
hey,

Does anybody have a function lying around (preferably pl/pgsql) that
takes a table name and returns coverage counts?

e.g.

#> select * from column_counts('cats'::regclass);
column_name | all_count | present_count | null_count | coverage |
---------------------------------------
name | 300 | 100 | 200 | 0.66

Thanks!
Seamus

--
Seamus Abshere, SCEA
https://www.faraday.io
https://github.com/seamusabshere
https://linkedin.com/in/seamusabshere


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: [GENERAL] Catching errors inside a LOOP is causing performance issues
Next
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] Catching errors inside a LOOP is causing performance issues