Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PostgreSQL事务ID向后移动_Postgresql_Transactions - Fatal编程技术网

PostgreSQL事务ID向后移动

PostgreSQL事务ID向后移动,postgresql,transactions,Postgresql,Transactions,在PostgreSQL 9.0中,我有一个跟踪上次处理的事务的表。由于某种原因,它(在时间上)倒退了!以下是表格数据: seq_id | tx_id 628 | 10112 629 | 10118 630 | 10124 631 | 10130 632 | 10136 654 | 10160 655 | 10166 <--- 656 | 4070 <--- 657 | 4071 658 | 4084 659

在PostgreSQL 9.0中,我有一个跟踪上次处理的事务的表。由于某种原因,它(在时间上)倒退了!以下是表格数据:

seq_id | tx_id
   628 | 10112
   629 | 10118
   630 | 10124
   631 | 10130
   632 | 10136
   654 | 10160
   655 | 10166  <---
   656 |  4070  <---
   657 |  4071
   658 |  4084
   659 |  4090
   660 |  4096
seq_id | tx_id
628 | 10112
629 | 10118
630 | 10124
631 | 10130
632 | 10136
654 | 10160

655 | 10166这是一个无效的问题。请忽略

事实证明,问题来自于从备份中恢复表并在新创建的数据库中继续使用(无效)以前的数据:-(

感谢所有已经回复的人

案件结案


吸取的教训:如果使用主/从设置,TXID不会倒退,它们会同步到从实例。TXID翻转也得到了正确处理。希望这能帮助其他可能认为TXID可以倒退的人!

列类型是什么?int/xid?表说明:seq_id bigserial NOT NULL,tx_id integer NOT NULL UNIQUE seq_id主键。tx_id来自何处?如果它是PostgreSQL事务id,则这些id基于循环的无符号32位数字--这些数字在任何延长的时间段内都不会是唯一的。这可能有助于阅读: