Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2015-03-24 Thread Bruce Momjian
On Fri, Mar 20, 2015 at 04:43:42PM -0400, Bruce Momjian wrote: On Sat, Nov 8, 2014 at 09:53:18PM +0100, Álvaro Hernández Tortosa wrote: On 07/11/14 22:02, Greg Sabino Mullane wrote: Kevin Grittner wrote: I think most people have always assumed that BEGIN starts the transaction and

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2015-03-24 Thread Álvaro Hernández Tortosa
On 24/03/15 20:56, Bruce Momjian wrote: On Fri, Mar 20, 2015 at 04:43:42PM -0400, Bruce Momjian wrote: On Sat, Nov 8, 2014 at 09:53:18PM +0100, Álvaro Hernández Tortosa wrote: On 07/11/14 22:02, Greg Sabino Mullane wrote: Kevin Grittner wrote: I think most people have always assumed that

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2015-03-20 Thread Bruce Momjian
On Sat, Nov 8, 2014 at 09:53:18PM +0100, Álvaro Hernández Tortosa wrote: On 07/11/14 22:02, Greg Sabino Mullane wrote: Kevin Grittner wrote: I think most people have always assumed that BEGIN starts the transaction and that is the point at which the snapshot is obtained. But there is so

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-08 Thread Álvaro Hernández Tortosa
On 06/11/14 15:00, Kevin Grittner wrote: Álvaro Hernández Tortosa a...@8kdata.com wrote: There has been two comments which seem to state that changing this may introduce some performance problems and some limitations when you need to take out some locks. I still believe, however, that

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-08 Thread Álvaro Hernández Tortosa
On 07/11/14 22:02, Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Kevin Grittner wrote: I think most people have always assumed that BEGIN starts the transaction and that is the point at which the snapshot is obtained. But there is so much evidence to the

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-07 Thread Robert Haas
On Wed, Nov 5, 2014 at 7:17 PM, Álvaro Hernández Tortosa a...@8kdata.com wrote: Given a transaction started with BEGIN (REPEATABLE READ | SERIALIZABLE), if a concurrent session commits some data before *any* query within the first transaction, that committed data is seen by the

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-07 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Kevin Grittner wrote: I think most people have always assumed that BEGIN starts the transaction and that is the point at which the snapshot is obtained. But there is so much evidence to the contrary. Not only does the *name* of the

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-06 Thread Álvaro Hernández Tortosa
On 06/11/14 02:06, Jim Nasby wrote: On 11/5/14, 6:04 PM, Álvaro Hernández Tortosa wrote: On 05/11/14 17:46, Jim Nasby wrote: On 11/4/14, 6:11 PM, Álvaro Hernández Tortosa wrote: Should we improve then the docs stating this more clearly? Any objection to do this? If we go that route

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-06 Thread Kevin Grittner
Álvaro Hernández Tortosa a...@8kdata.com wrote: There has been two comments which seem to state that changing this may introduce some performance problems and some limitations when you need to take out some locks. I still believe, however, that current behavior is confusing for the user.

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-06 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Kevin Grittner wrote: (wording change suggestion) | sees a snapshot as of the start of the first query within the | transaction, not as of the start of the current query within the | transaction. Would that have prevented the confusion

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-06 Thread Kevin Grittner
Greg Sabino Mullane g...@turnstep.com wrote: Kevin Grittner wrote: (wording change suggestion) | sees a snapshot as of the start of the first query within the | transaction, not as of the start of the current query within the | transaction. Would that have prevented the confusion here? I

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-06 Thread Tom Lane
Kevin Grittner kgri...@ymail.com writes: Why? This fix might not deal with the bigger issues that I discussed, like that the later-to-start and later-to-acquire-a-snapshot transaction might logically be first in the apparent order of execution. You can't fix that without a lot of blocking

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-05 Thread Jim Nasby
On 11/4/14, 6:11 PM, Álvaro Hernández Tortosa wrote: Should we improve then the docs stating this more clearly? Any objection to do this? If we go that route we should also mention that now() will no longer be doing what you probably hope it would (AFAIK it's driven by BEGIN and not the

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-05 Thread Kevin Grittner
Jim Nasby jim.na...@bluetreble.com wrote: If we go that route we should also mention that now() will no longer be doing what you probably hope it would (AFAIK it's driven by BEGIN and not the first snapshot). There is also the fact that pg_stat_activity shows a connection as being idle in

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-05 Thread Robert Haas
On Mon, Nov 3, 2014 at 2:14 PM, Álvaro Hernández Tortosa a...@8kdata.com wrote: Given a transaction started with BEGIN (REPEATABLE READ | SERIALIZABLE), if a concurrent session commits some data before *any* query within the first transaction, that committed data is seen by the

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-05 Thread Álvaro Hernández Tortosa
On 05/11/14 17:46, Jim Nasby wrote: On 11/4/14, 6:11 PM, Álvaro Hernández Tortosa wrote: Should we improve then the docs stating this more clearly? Any objection to do this? If we go that route we should also mention that now() will no longer be doing what you probably hope it would

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-05 Thread Álvaro Hernández Tortosa
On 06/11/14 00:42, Robert Haas wrote: On Mon, Nov 3, 2014 at 2:14 PM, Álvaro Hernández Tortosa a...@8kdata.com wrote: Given a transaction started with BEGIN (REPEATABLE READ | SERIALIZABLE), if a concurrent session commits some data before *any* query within the first transaction,

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-05 Thread Jim Nasby
On 11/5/14, 6:04 PM, Álvaro Hernández Tortosa wrote: On 05/11/14 17:46, Jim Nasby wrote: On 11/4/14, 6:11 PM, Álvaro Hernández Tortosa wrote: Should we improve then the docs stating this more clearly? Any objection to do this? If we go that route we should also mention that now() will

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-05 Thread Tom Lane
Jim Nasby jim.na...@bluetreble.com writes: Hmm... we do have transaction_timestamp(); perhaps we could leave that as the time BEGIN executed and shift everything else to use the snapshot time. It's not possible to take a timestamp that *exactly* matches the snapshot time. We could rearrange

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-04 Thread Craig Ringer
On 11/04/2014 07:31 AM, Álvaro Hernández Tortosa wrote: Thank you for your comment, Tom. However I think this behavior, as seen from a user perspective, it's not the expected one. That may be the case, but I think it's the SQL-standard behaviour, so we can't really mess with it. The spec

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-04 Thread Álvaro Hernández Tortosa
On 04/11/14 09:07, Craig Ringer wrote: On 11/04/2014 07:31 AM, Álvaro Hernández Tortosa wrote: Thank you for your comment, Tom. However I think this behavior, as seen from a user perspective, it's not the expected one. That may be the case, but I think it's the SQL-standard behaviour, so

[HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-03 Thread Álvaro Hernández Tortosa
Hi! Given a transaction started with BEGIN (REPEATABLE READ | SERIALIZABLE), if a concurrent session commits some data before *any* query within the first transaction, that committed data is seen by the transaction. This is not what I'd expect. Specifically, the documentation

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-03 Thread Tom Lane
=?ISO-8859-1?Q?=C1lvaro_Hern=E1ndez_Tortosa?= a...@8kdata.com writes: IMHO, from a user perspective the transaction begins when the BEGIN command is issued. If I really want to see a frozen view of the database before any real SELECT, I have to issue another query like SELECT 1. This

Re: [HACKERS] Repeatable read and serializable transactions see data committed after tx start

2014-11-03 Thread Álvaro Hernández Tortosa
On 03/11/14 22:19, Tom Lane wrote: =?ISO-8859-1?Q?=C1lvaro_Hern=E1ndez_Tortosa?= a...@8kdata.com writes: IMHO, from a user perspective the transaction begins when the BEGIN command is issued. If I really want to see a frozen view of the database before any real SELECT, I have to issue