[英]What will happen if you insert 5 billion rows as independent transactions? What will the vaccum do to the xmin column?
I understand that xmin is limited to 2^32-1, about 4 billion entries.我了解 xmin 限制为 2^32-1,大约 40 亿个条目。 Vacuum cleans up dead tuples, postgres maintains a transaction for every update to a row and those are cleaned up as a process of vacuum.
Vacuum 清理死元组,postgres 为对行的每次更新维护一个事务,并且这些事务作为一个清理过程被清理。 Lets say, i am just inserting 5 billion records all independent transactions.
可以说,我只是插入了 50 亿条记录,所有独立交易。
What is the dead tuple, in the above scenario?在上述场景中,死元组是什么?
When does the vacuum run automatically, around the 2 billion entries, what does it clean at this point?真空何时自动运行,大约 20 亿个条目,此时它会清理什么?
what happens to the xmin for the 1st 2 billion records as the vacuum process starts ?当真空过程开始时,第一个 20 亿条记录的 xmin 会发生什么变化?
Let's say, i stored the xmin of the 100,000 transactions, as in keep pushing the insert transactions.比方说,我存储了 100,000 个事务的 xmin,因为不断推送插入事务。 After i inserted the 5 billion transactions, i want to query for all of my transaction after the 100,000 xmin and xmin < 500,000.
插入 50 亿笔交易后,我想查询 100,000 xmin 和 xmin < 500,000 之后的所有交易。 Will this work?
这行得通吗?
Postgresql will trigger an autovacuum to avoid WRAPAROUND, the autovacuum will freez old transaction. Postgresql 将触发自动清理以避免 WRAPROUND,自动清理将冻结旧事务。
you can read: https:\/\/www.cybertec-postgresql.com\/en\/autovacuum-wraparound-protection-in-postgresql\/<\/a>您可以阅读:
https<\/a> :\/\/www.cybertec-postgresql.com\/en\/autovacuum-wraparound-protection-in-postgresql\/
In old versions, freezing a tuple involved changing the xmin to a magic value of 2. see src\/include\/access\/transam.h:在旧版本中,冻结元组涉及将 xmin 更改为魔法值 2。请参阅 src\/include\/access\/transam.h:
#define FrozenTransactionId ((TransactionId) 2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.