Обсуждение: Materialized View Estimation in Postgres

Поиск
Список
Период
Сортировка

Materialized View Estimation in Postgres

От
Sahul Hameed
Дата:
Team,

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. 

Thanks and regards,
Sahul Hameed 

Re: Materialized View Estimation in Postgres

От
Thomas Kellerer
Дата:
> 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;