pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dave@davebolt.co.uk
To: 'sbob' <sbob@quadratum-braccas.com>
To: 'David G. Johnston' <david.g.johnston@gmail.com>
Cc: 'Pgsql-admin' <pgsql-admin@lists.postgresql.org>
Subject: RE: column max length / max timestamps from system tables
Date: Wed, 2 Jun 2021 21:00:53 +0100
Message-ID: <06f401d757e9$fe3b13c0$fab13b40$@co.uk> (raw)
In-Reply-To: <3cf4cc46-c017-a279-dec0-c68a99836bb2@quadratum-braccas.com>
References: <ece3ad60-60fc-fbf2-f790-3739965ae098@quadratum-braccas.com>
	<CAKFQuwZ--+Misi5Li=1658cesYT5e92jR_AcZBEuo7PD8abT6A@mail.gmail.com>
	<3cf4cc46-c017-a279-dec0-c68a99836bb2@quadratum-braccas.com>

I don’t have suitable data to hand to test, but I would expect finding the max on a timestamp column would be PDQ, especially if it is an indexed column.

For the other column I’m guessing more work has to be done finding the length for each row. Maybe maintaining a column containing the current length for each row would help?

Anyway, can you test the max timestamp and the max col length separately to confirm where the time goes?

Re-reading the original question makes me think there may be more complexity to your querie(s) then I realise.

Dave

 

From: sbob [mailto:sbob@quadratum-braccas.com] 
Sent: 02 June 2021 20:18
To: David G. Johnston
Cc: Pgsql-admin
Subject: Re: column max length / max timestamps from system tables

 

Unfortunately this takes hours since the table has > 500million rows

just wanted to see if there was a shorrtcut / alternate

 

On 6/2/21 11:13 AM, David G. Johnston wrote:

 

On Wed, Jun 2, 2021, 10:05 sbob <sbob@quadratum-braccas.com> wrote:

Hi all;


we need to pull the max timestamp for a set of columns and the max 
string length for another set of columns. Can I get this from system 
tables? If so, how up to date would it be?

 

No.  Just query the table directly.

 

David J.

 

 

view thread (9+ messages)  latest in thread

Message-ID: <06f401d757e9$fe3b13c0$fab13b40$@co.uk>
Permalink:  ../06f401d757e9$fe3b13c0$fab13b40$@co.uk/
Also on:    postgresql.org/message-id/06f401d757e9$fe3b13c0$fab13b40$@co.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: dave@davebolt.co.uk, sbob@quadratum-braccas.com, david.g.johnston@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: RE: column max length / max timestamps from system tables
  In-Reply-To: <06f401d757e9$fe3b13c0$fab13b40$@co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox