Is there a faster alternative to using dblink or fdw extension to create materialized views in Postgres?

184 Views Asked by At

I used the dblink (into postgresql) to create materialized views from another base. However, this way is not optimal I use it like this:

CREATE MATERIALIZED VIEW schema.vm_nom
AS SELECT t1.colonne1, t1.colonne2 , t3.geom 

   FROM dblink('hostaddr=127.0.0.1 port=5432 user=user dbname=dbname  password=psswrd', 
'select colonne1, colonne2, geom from schema.t1') t1(colonne1 varchar(24),  
colonne2 varchar(127), geom geometry(geometry, 2154))

Is there another way to do it, especially when calling columns with their type, this is very long?

I also thought of the fdw extension but I don't quite understand how it works. I specify that in my case, I connect 2 bases in local.

Thanks in advance.

0

There are 0 best solutions below