From: | Seamus Abshere <seamus(at)abshere(dot)net> |
---|---|
To: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Function to return per-column counts? |
Date: | 2017-09-28 19:31:23 |
Message-ID: | 1506627083.7890.1121668992.54ADF7AE@webmail.messagingengine.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> > > Does anybody have a function lying around (preferably pl/pgsql) that
> > > takes a table name and returns coverage counts?
> >
> > What is "coverage count"?
Ah, I should have explained better. I meant how much of a column is
null.
Basically you have to
0. count how many total records in a table
1. discover the column names in a table
2. for each column name, count how many nulls and subtract from total
count
If nobody has one written, I'll write one and blog it.
Thanks!
Seamus
PS. In a similar vein, we published
http://blog.faraday.io/how-to-do-histograms-in-postgresql/ which gives
plpsql so you can do:
SELECT * FROM histogram($table_name_or_subquery, $column_name)
--
Seamus Abshere, SCEA
https://www.faraday.io
https://github.com/seamusabshere
https://linkedin.com/in/seamusabshere
From | Date | Subject | |
---|---|---|---|
Next Message | Melvin Davidson | 2017-09-28 19:52:27 | Re: Function to return per-column counts? |
Previous Message | John McKown | 2017-09-28 17:22:49 | Re: Function to return per-column counts? |