Search Postgresql Archives

Help to find-the-maximum-length-of-field-in-a-particular-column-in-all the tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Team,

Good Evening,

We are trying to syncing the table field size with other db tables filed size.

We have multiple tables in multiple schemas in DB. we are tyring to findout maximum size of each column in table for all tables and for all schemas in DB.

How to find the maximum length of data field in a particular column in a table and for all tables in schema.

Example column names in table: a,b,c,d,e,f,g
Example schema names in DB: A,B,C,D

Expected output:
column_name Max_size_of_column
a 10
b 20

or
column_name, Max_size_of_column, column_table, table_schema
a 10 Table1 Schema1
b 20 Table1 Schema1

I have tried below query, but not able to get desired output.

SELECT (select column_name from INFORMATION_SCHEMA.COLUMNS where table_name='building'), select max(length(select column_name from INFORMATION_SCHEMA.COLUMNS where table_name='building')) from from INFORMATION_SCHEMA.COLUMNS where table_name='building'
group by column_name;

Please help us to get the desired output.

Below is the reference i have used for above one. https://stackoverflow.com/questions/43123311/how-to-find-the-maximum-length-of-data-in-a-particular-field-in-postgresql

Regards,
Postgann.  

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux