Detailed explanation of PostgreSQL version identification

jacklove
Release: 2018-06-11 17:22:42
Original
2298 people have browsed it

Insert\delete\updateLocate viactid, and view the changes in the recordxmin\xmax.

Xid: Database transactionID;

Xmin: Row headerxidInformation,xminrepresents the transaction that inserted the recordID

Xmax: Indicates deletion orlockThe transaction of this recordID

xid_snapshot: Ended in the current cluster Transaction

Clog: Transaction submission status log

Definition of record format: htup_details.h:POSTGRES heap tuple header definitions.

1) View allxidrelated functions. What is needed here istxid_currentFunction

##2)

can be seen Current transactionID

postgres=# select * from txid_current(); txid_current -------------- 1676 (1 row) 3)进行一次insert后,看事务ID已经+1 postgres=# insert into tt values(1); INSERT 0 1 postgres=# select ctid,xmin,xmax,cmin,cmax,id from tt; ctid | xmin | xmax | cmin | cmax | id -------+------+------+------+------+---- (0,1) | 1677 | 0 | 0 | 0 | 1 (1 row)
Copy after login

4)

After opening a transaction, proceedupdate

postgres=# begin; BEGIN postgres=# update tt set id=3; UPDATE 1 postgres=# select ctid,xmin,xmax,cmin,cmax,id from tt; ctid | xmin | xmax | cmin | cmax | id -------+------+------+------+------+---- (0,2) | 1678 | 0 | 0 | 0 | 3 (1 row)
Copy after login

5) View

postgres=# select ctid,xmin,xmax,cmin,cmax,id from tt; ctid | xmin | xmax | cmin | cmax | id -------+------+------+------+------+---- (0,1) | 1677 | 1678 | 0 | 0 | 1 (1 row)
Copy after login


## in another session to see the current unfinished transactions or unopened transactions Transaction

##

postgres=# select *from txid_current_snapshot(); txid_current_snapshot ----------------------- 1684:1684: (1 row) postgres=# select * from txid_current(); txid_current -------------- 1684 (1 row)
Copy after login

Record whether the transaction is submitted, in In this file,

bit

:

-rw-------. 1 pg pg 8192 Jun 10 04:19 0000 [pg@localhost pg_clog]$ pwd /home/pg/data/pg_clog
Copy after login
This article introduces PostgreSQL version identification. For more related content, please pay attention to the php Chinese website.

Related recommendations:

Explain what B/S and C/S are


How to achieve it through css3 html5 Vertical menu


#Related explanations about HTML5 local storage

The above is the detailed content of Detailed explanation of PostgreSQL version identification. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!