Re: Least Active Transaction ID function

Lists: pgsql-hackers
From: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Least Active Transaction ID function
Date: 2014-07-23 15:01:12
Message-ID: CANqGtSu1bw+8p8f3pwepu4Vw56R86F+97KqkaG+Ta0J6CxWdkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi All,

I am doing programming with postgresql source code. I want to find out the
function which can give me Least active transaction id currenty in the
system.

Is there any function which can give me that?

Regards,
Rohit Goyal


From: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Least Active Transaction ID function
Date: 2014-07-23 19:53:57
Message-ID: CANqGtSshwi+RyRxdNWOMtd2jaHLP3LiFPQ=6+DqBR2n+tvX+xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi All,

On Wed, Jul 23, 2014 at 5:01 PM, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:

> Hi All,
>
> I am doing programming with postgresql source code. I want to find out the
> function which can give me Least active transaction id currenty in the
> system.
>
> Is there any function which can give me that?
>
> Regards,
> Rohit Goyal
>

1> I know that somewhere there is an active transaction list in postgresql.
At any point of time, I want to get the smallest transaction present in
this active tx list or I want to get the transaction id before which all
transaction smaller than that are committed/aborted.

Is there any function which can give me this value?

2> I found a function giving *GetStableLatestTransactionId()*, please tel
me what this function gives. I was not able to understand the description
given above it.

Thanks for support in advance :)!!

Regards,
Rohit Goyal


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Least Active Transaction ID function
Date: 2014-07-24 19:32:06
Message-ID: CA+TgmobcDFbKRfuMk5e9XwcU4-q2pgv2+S+XS63cFGqvfGD=5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Jul 23, 2014 at 3:53 PM, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:
> Hi All,
>
> On Wed, Jul 23, 2014 at 5:01 PM, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:
>>
>> Hi All,
>>
>> I am doing programming with postgresql source code. I want to find out the
>> function which can give me Least active transaction id currenty in the
>> system.
>>
>> Is there any function which can give me that?
>>
>> Regards,
>> Rohit Goyal
>
> 1> I know that somewhere there is an active transaction list in postgresql.
> At any point of time, I want to get the smallest transaction present in this
> active tx list or I want to get the transaction id before which all
> transaction smaller than that are committed/aborted.
>
> Is there any function which can give me this value?

See the RecentXmin calculation in GetSnapshotData.

> 2> I found a function giving GetStableLatestTransactionId(), please tel me
> what this function gives. I was not able to understand the description given
> above it.

I don't know how to help with this; the description seems clear to me.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Least Active Transaction ID function
Date: 2014-07-24 19:42:51
Message-ID: CANqGtSumHUZAh7uK8WAS3snTxuDCz5BES_GGQdm7MQZdyXEpfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Robert,

On Thu, Jul 24, 2014 at 9:32 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Wed, Jul 23, 2014 at 3:53 PM, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:
> > Hi All,
> >
> > On Wed, Jul 23, 2014 at 5:01 PM, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
> wrote:
> >>
> >> Hi All,
> >>
> >> I am doing programming with postgresql source code. I want to find out
> the
> >> function which can give me Least active transaction id currenty in the
> >> system.
> >>
> >> Is there any function which can give me that?
> >>
> >> Regards,
> >> Rohit Goyal
> >
> > 1> I know that somewhere there is an active transaction list in
> postgresql.
> > At any point of time, I want to get the smallest transaction present in
> this
> > active tx list or I want to get the transaction id before which all
> > transaction smaller than that are committed/aborted.
> >
> > Is there any function which can give me this value?
>
> See the RecentXmin calculation in GetSnapshotData.
>
> This was really -2 helpful.
1. Can I use this xmin variable directly anytime anywhere in my code as it
is a global variable.
2. What is the difference b/w recentXmin and RecentGlobalXmin. I read the
description but any small detail can clear my mind. :)

Thanks in advance!!

> > 2> I found a function giving GetStableLatestTransactionId(), please tel
> me
> > what this function gives. I was not able to understand the description
> given
> > above it.
>
> I don't know how to help with this; the description seems clear to me.
>
> This is not important now, as you have already told me the variable and
file for recentXmin.:)

Regards,
Rohit

> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

--
Regards,
Rohit Goyal


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Least Active Transaction ID function
Date: 2014-07-28 15:52:43
Message-ID: CA+TgmoZ+ZS2r4n6Of_faB=UmZy-PwcxoUpdQSJjpy33hgiGorA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jul 24, 2014 at 3:42 PM, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:
> This was really -2 helpful.

I'm not sure what it means to be -2 helpful. Hopefully it's a good thing.

> 1. Can I use this xmin variable directly anytime anywhere in my code as it
> is a global variable.

I don't really know what you're asking. If you want a tutorial on how
global variables work in C, this is the wrong mailing list to ask
about that.

> 2. What is the difference b/w recentXmin and RecentGlobalXmin. I read the
> description but any small detail can clear my mind. :)

RecentXmin is the oldest transaction ID that was still running as of
the last time it was updated. RecentGlobalXmin is the oldest
transaction ID that was part of somebody's snapshot as of the last
time it was updated. Transaction IDs older than RecentXmin can be
assumed not to be running, but there could be still-running
transactions that can't see the effected of some committed transaction
whose ID precedes RecentXmin. Transaction IDs older than
RecentGlobalXmin are no longer running, and furthermore any the
effects of any such transactions which went on to commit are
guaranteed to be visible to the snapshots of all currently-running
transactions, and all future transactions.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company