Re: Materialized View Estimation in Postgres

From: Thomas Kellerer <shammat(at)gmx(dot)net>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Materialized View Estimation in Postgres
Date: 2020-04-15 20:52:35
Message-ID: 57c9152b-85bf-6b9e-d1e2-8f0278882596@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> I would like to know if there are any oracle equivalent of
> dbms_mview.estimate_mview_size in Postgres as we have been using it
> in Oracle for estimating required size for the upcoming mviews but
> after migration to Postgres we find it very hard to estimate the
> size.. Sometime our rds ran out of space and we had to spend lot of
> efforts and time to bring back the rds once after rds storage is
> exhausted. Or is there any other options available which can be used
> to estimate the size.

A very rough estimation could be to use pg_column_size() on the rows of your SELECT statement and aggregate that.
Despite it's name pg_column_size() also calculates the size of a complete row.

select sum(pg_column_size(mv))
from (
.... your select statement here ...
) mv;

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Devrim Gündüz 2020-04-16 11:05:14 Re: pgAdmin4 dependency package "python3-psycopg2" should be place in "pgdg-common" repo.
Previous Message David G. Johnston 2020-04-15 18:46:43 Re: user with autentication windows