简体   繁体   English

"<i>What will happen if you insert 5 billion rows as independent transactions?<\/i>如果将 50 亿行作为独立事务插入会发生什么?<\/b> <i>What will the vaccum do to the xmin column?<\/i> vaccum 会对 xmin 列做什么?<\/b>"

[英]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 亿条记录,所有独立交易。

  1. What is the dead tuple, in the above scenario?在上述场景中,死元组是什么?

    <\/li>

  2. When does the vacuum run automatically, around the 2 billion entries, what does it clean at this point?真空何时自动运行,大约 20 亿个条目,此时它会清理什么?

    <\/li>

  3. what happens to the xmin for the 1st 2 billion records as the vacuum process starts ?当真空过程开始时,第一个 20 亿条记录的 xmin 会发生什么变化?

    <\/li>

  4. 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?这行得通吗?

    <\/li><\/ol>"

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\/

Best regards,最好的祝福,

"

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.

相关问题 在PostgreSQL中运行N个独立列更新的最佳方法是什么? 在SQL规范中执行此操作的最佳方法是什么? - What is the best way to run N independent column updates in PostgreSQL? What is the best way to do it in the SQL spec? PostgreSQL 中 TOAST 表的大小限制是多少? 40 亿行或 40 亿个 chunk_id 值? - What is the size limit of a TOAST table in PostgreSQL? 4 billion rows o 4 billions values of chunk_id? Postgres中的xmin和cmin列 - xmin and cmin column in postgres 如果两个流程同时修改两个事务中的数据并且在表上存在唯一约束,将会发生什么? - What will happen if two processes modify data in two transactions at the same time and there is a unique constraint on the table? 当一列是变量值时,如何将行插入 Postgresql 8.4? - How do you insert rows into Postgresql 8.4 when one column is a variable value? 如何更有效地更新此表中的13亿行? - How do I update 1.3 billion rows in this table more efficiently? pg_stat_activity 中的 backend_xmin 和 backend_xid 代表什么? - What does backend_xmin and backend_xid represent in pg_stat_activity? while 循环对 pg_fetch_array($result) 做了什么,以便您获得下一行并结束 - What does the while loop do for the pg_fetch_array($result) such that you get next rows and end PostgreSQL INSERT确认参数是什么意思? - What Do PostgreSQL INSERT confirmation params mean? PostgreSQL:如何将带有循环的数据行插入数据库表? - PostgreSQL: How do you insert rows of data with a loop into a database table?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM