Re: Using FOREIGN TABLE to get the Size of the Actual Remote Table Behind it

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Avi Weinberg <AviW(at)gilat(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Using FOREIGN TABLE to get the Size of the Actual Remote Table Behind it
Date: 2022-01-13 19:22:28
Message-ID: 4496811616006330d67b6c309b1028f20eb5b36c.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2022-01-13 at 09:49 +0000, Avi Weinberg wrote:
> Is it possible to get the size of the table a foreign table is pointing to (without creating
> another connecting to the remote server)?  Obviously this "select
> pg_size_pretty(pg_total_relation_size('f_table'))" returns 0.

No, there is no straightforward way to do that.

What you could do is create a view on the remote database that provides the
required information and access that view via a foreign table.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gautam Bellary 2022-01-13 21:30:59 Assistance with an out of shared memory error
Previous Message Shaozhong SHI 2022-01-13 15:55:20 Re: How can a Postgres SQL script be automatically run when a new table turns up?