From: | Moshe Jacobson <moshe(at)neadwerx(dot)com> |
---|---|
To: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
Cc: | "Yelai, Ramkumar IN BLR STS *EXTERN*" <ramkumar(dot)yelai(at)siemens(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Parallel Insert and Delete operation |
Date: | 2012-10-31 15:31:06 |
Message-ID: | CAJ4CxL=ejPBTwZDSRhX9dQNSZRup5n56JvYh9z0aLzD=N+rCGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
It is also possible that you will get a foreign key violation exception on
the process inserting into table 2, but you will not get database
inconsistency.
On Wed, Oct 31, 2012 at 9:33 AM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>wrote:
> Yelai, Ramkumar IN BLR STS worte:
> > Sent: Wednesday, October 31, 2012 12:40 PM
> > To: pgsql-general(at)postgresql(dot)org
> > Subject: [GENERAL] Parallel Insert and Delete operation
> >
> > Hi All,
> >
> > Please clarify me the following example.
> >
> > I have 2 tables
> >
> > Table1 - ( it has one primary key and few columns )
> > Table2 - ( it has one primary key and few columns. It has one
> foreign key, which refers table1
> > primary key ).
> >
> > I have 2 operations, which are written in pl/pgsql procedure.
> >
> > Operation1() - Inserts the records to table2 at every hour basis.
> > Operation2() - Delete the records from Table 1 and Table2 based on the
> primary key.
> >
> > What if both operations are running at the time for the same primary
> key.
> >
> > what I have to take care to run these two operations perfectly without
> creating inconsistency in
> > database.
>
> With the foreign key in place there can be no entry in table2
> that does not have a corresponding entry in table1.
>
> Concurrency is solved with locks, so one of the concurrent
> operations might have to wait until the other one is done.
>
> That is handled by the database system automatically.
>
> Yours,
> Laurenz Albe
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
--
Moshe Jacobson
Nead Werx, Inc. | Senior Systems Engineer
2323 Cumberland Parkway, Suite 201 | Atlanta, GA 30339
moshe(at)neadwerx(dot)com | www.neadwerx.com
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2012-10-31 15:50:33 | Re: Why SyncOneBuffer does not called frequently? |
Previous Message | Alexander Gataric | 2012-10-31 15:22:29 | Boolean type storage format |