Abscence of synonym

From: Rakesh Kumar <rakeshkumar464(at)outlook(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Abscence of synonym
Date: 2016-11-07 19:39:18
Message-ID: DM2PR05MB622A2125CD00A9948DA13EC8CA70@DM2PR05MB622.namprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I need some ideas here.

Let us say we have a bunch of tables, called a,b,c,d. We will get a batch of data in files which need to be processed. At the end of processing, the tables will get a fresh set of data. The problem we would like to solve is to allow access to the tables while they are getting processed by the new batch. Obviously, during the processing the data will be in an inconsistent state, which the app should not be exposed to. At the end of processing, the app can see the new data.

In RDBMS where synonyms are allowed we would do this:

keep two set of tables a_1 and a_2
A synonym a will either point to a_1 or a_2.
applications will refer synonym a only, never a_1 or a_2.
While synonym is referring to a_1, we can process a_2.
At the end of processing change the synonym to point to a_2.
next time, repeat it, just flip the tables from a_2 to a_1.

How this can be done in PG 9.5.3?

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2016-11-07 20:01:11 Re: Abscence of synonym
Previous Message Joanna Xu 2016-11-07 19:29:03 Re: Questions on Post Setup MASTER and STANDBY replication - Postgres9.1