A report of all the data contained into a postgres schema
Published On May 24, 2016
Need a simple and effective way read the informative content of a postgres schema?
You can use the following procedure that creates for every table, for every attribute a row.
The row contains:
- table_schema: the name of the schema,
- table_name: the name of the table,
- table_attribute: the name of the attribute,
- table_attribute_type: the type of the attribute in both declared and internal representation
- record_number: number of the record in the table,
- distinct_values: number of distinct values for the attributes,
- min_value text: minimum value of the attribute (null not counted) ,
- max_value text:maximum value of the attribute (null not counted),
- null_count: number of null occurences for the attributes,
- not_null_count: number of not null occurences for the attributes
The execution of the procedure is a quite long task, it could be reasonable to materialize a view…
Have you found a better approach? I’m open to your suggestions.
comments powered by