0

I have a view on the primary database, now I want to have the data of this view to be on the secondary database but in a table. Is there a way or a third-party tool to keep the view data in sync with the table in postgres?

  • 1
    In what way do you think a view gets "out of sync" with its underlying tables? – Richard Huxton May 02 '23 at 15:31
  • and what do you mean by another database? In PG locally you have many databases, but when replication comes - it is about different hosts / nodes... Can you, please, elaborate more about the setup, and what you are trying to achieve? For the moment - answer is - "had to say". – Michał Zaborowski May 02 '23 at 15:54
  • A view is just a stored query which is executed whenever the view is accessed. Thus the view data **cannot** be out-of-sync with the underlying table(s). The only exception being if the view in based on a materialized view, but then it is always in-sync with the last refresh. Is it actually the view or is it the secondary database table you are trying to sync? – Belayer May 02 '23 at 20:00

0 Answers0