Function to return per-column counts?

From: Seamus Abshere <seamus(at)abshere(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Function to return per-column counts?
Date: 2017-09-28 14:34:59
Message-ID: 1506609299.1312748.1121344704.08A3A454@webmail.messagingengine.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2017-09-28 15:02:14 Re: Catching errors inside a LOOP is causing performance issues
Previous Message Pavel Stehule 2017-09-28 13:07:59 Re: Catching errors inside a LOOP is causing performance issues