| From: | Chris Travers <chris(dot)travers(at)gmail(dot)com> |
|---|---|
| To: | Rob Nikander <rob(dot)nikander(at)gmail(dot)com> |
| Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Is the row version available in SQL? |
| Date: | 2017-06-28 15:39:20 |
| Message-ID: | CAKt_Zfs6Lz02XO4=C9pw1wcM2AraFCiu2_ss53XEt9AnrQG0nA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Wed, Jun 28, 2017 at 4:54 PM, Rob Nikander <rob(dot)nikander(at)gmail(dot)com>
wrote:
> Hi,
>
> I'm reading about MVCC here: https://www.postgresql.
> org/docs/current/static/mvcc.html.
>
> In some cases I can use these transaction isolation modes, but in other
> cases, I may want to manage the versions and concurrency manually. Is there
> a way to select the “version” of a row, or is that data hidden to ordinary
> SQL statements?
>
> I’m thinking about a sequence of actions, which are logically a
> transaction, but start on one thread and complete later on another thread.
> I don’t think I can tie up a JDBC database connection for that long. I can
> add a `version bigint` column to my table, and the final update will look
> like:
>
> update ... where id = ? and version = the_version_selected_earlier_
> in_a_different_thread
>
> … and if that gets 0 rows, it can handle the conflict.
>
For that, you could use xmin. That tracks the transaction where the row
first became visible.
Best Wishes,
Chris Travers
>
> Rob
>
>
>
--
Best Wishes,
Chris Travers
Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor
lock-in.
http://www.efficito.com/learn_more
| From | Date | Subject | |
|---|---|---|---|
| Next Message | marcelo | 2017-06-28 16:28:53 | Re: Unknown lvalue 'PIDFILE' in section 'Service' |
| Previous Message | Rob Nikander | 2017-06-28 14:54:14 | Is the row version available in SQL? |