Re: XID comparations
От | Martijn van Oosterhout |
---|---|
Тема | Re: XID comparations |
Дата | |
Msg-id | 20060613154714.GG19212@svana.org обсуждение исходный текст |
Ответ на | XID comparations ("Carlos H. Reimer" <carlosreimer@terra.com.br>) |
Ответы |
RES: XID comparations
|
Список | pgsql-general |
On Tue, Jun 13, 2006 at 12:10:26PM -0300, Carlos H. Reimer wrote: > When xid overflows (32 bits) the next one will be 3 (1 and 2 are reserved). > > In this case, we could have have lines with cmin 4.294.967.295 and lines > with cmin 3. How are they compared to determine that > rows with cmin 3 are newer than rows with cmin 4.294.967.295? The same way you handle any circular numbering system, compare the difference. i.e. if( (xmin1-xmin2) mod (2^32) < 2^31 ) { xmin1 is newer than xmin2 } In the example you give: (3 - 4.294.967.295) mod (2^32) = -4294967292 mod (2^32) = 4 Hence XID 3 is newer compared to XID 4.294.967.295. Note in such a circular system, it is possible for A < B, B < C and C < A to all be simultaneously true. However, we always know where the current transaction is, so everything is compared to that. I hope this clears it up for you. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Вложения
В списке pgsql-general по дате отправления: