| From: | Vadim Mikheev <vadim(at)krs(dot)ru> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org |
| Subject: | Re: [HACKERS] It sorta works, but I'm confused about locking |
| Date: | 1998-10-02 01:20:25 |
| Message-ID: | 36142A59.311E12C9@krs.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Tom Lane wrote:
>
> > I can imagine some cases where you would want to get a lock and keep it
> > until the end of the transaction, and other times when you would want to
> > release it before transaction end.
>
> I guess I'm not understanding something. How can it ever be correct
> practice to release a lock before transaction end? For example, if I
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Postgres does this for system tables only.
> write some changes in a table, and then release the lock, wouldn't that
> allow other backends to see the not-yet-committed changes? What if I
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No. Backend uses xmin/xmax to know is tuple visible or not.
> then abort my transaction? Now the other backends have acted on
> information they should never have seen at all.
Backend will see that xmin(xmax) is not committed.
Vadim
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 1998-10-02 01:41:55 | Re: [HACKERS] rules ON SELECT |
| Previous Message | Tom Lane | 1998-10-02 00:29:17 | Re: [HACKERS] Proper cleanup at backend exit |