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

From: postgann2020 s <postgann2020(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Help to find-the-maximum-length-of-field-in-a-particular-column-in-all the tables
Date: 2020-04-04 03:02:03
Message-ID: CANynezNM1bDVBGkdvv08mn3CrX0CR0feHBNNZBatQ4EFJEg0aA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Got it David.
Thanks I will try.

On Fri, Apr 3, 2020, 12:56 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

> On Thu, Apr 2, 2020 at 10:15 PM postgann2020 s <postgann2020(at)gmail(dot)com>
> wrote:
>
>> We are trying to findout the max size of the data in columns for all
>> tables to resize the width of the assigned columns.
>>
>
> If you forgo brute force you will need to combine catalog access with
> dynamic SQL. I'm not offering to work out the specific syntax for you. If
> you've no better place to start the pl/pgsql documentation works as a
> language that provides this capability. The main problem you are solving
> is that identifiers (e.b., table and column names) in select queries must
> be provided in the query text so you need to insert them (ideally using the
> "format()" function and "%I (eye)" placeholder.
>
> I feel it bears repeating that this exercise seems like a poor one to
> perform (admittedly with zero actual knowledge as to the underlying
> situation). Resizing them to "no size restriction" (i.e., "col_name text")
> would be my preference. Higher risk fields might warrant constraints that
> check content in addition to (or in lieu of) length. That fact that you
> are wanting to perform this exercise in the first place would be sufficient
> evidence that the previous decision to have field length limits was a poor
> one. That my 0.02
>
> David J.
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Axel Rau 2020-04-04 15:48:24 NEEDING HELP: dropping none-existing extension
Previous Message Samed YILDIRIM 2020-04-03 18:01:12 Re: postgres performance on azure

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2020-04-04 07:07:51 Why there is 30000 rows is sample
Previous Message Thomas Munro 2020-04-04 00:48:57 Re: EINTR while resizing dsm segment.