gpt4 book ai didi

postgresql - select txid_current 和 select txid_current_snapshot 的区别

转载 作者:行者123 更新时间:2023-11-29 12:11:28 30 4
gpt4 key购买 nike

有以下内容

  Select txid_current();
Result:txid 004
Begin;
Insert into tab values(2,45);
Insert into tab values(3,56);
Commit;

当我这样做的时候

Select txid_current();
It txid shows :006
txid_current_snapshot();

显示 txid:05

两者有什么区别

最佳答案

好问题。

txid_current_snapshot 是 xmin:xmax:xip_list 的文本表示。例如 10:20:10,14,15 表示 xmin=10, xmax=20, xip_list=10, 14, 15。

xmin Earliest transaction ID (txid) that is still active. All earlier transactions will either be committed and visible, or rolled back and dead.

xmax First as-yet-unassigned txid. All txids later than this one are not yet started as of the time of the snapshot, and thus invisible.

xip_list Active txids at the time of the snapshot. All of them are between xmin and xmax. A txid that is xmin <= txid < xmax and not in this list was already completed at the time of the snapshot, and thus either visible or dead according to its commit status.

当您在终端中玩游戏时,您看不到差异,但当您有大量并行交易时,您可以看到。

关于postgresql - select txid_current 和 select txid_current_snapshot 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32613190/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com