The OID and XID descriptions in PostgreSQL _postgresql

Source: Internet
Author: User
Tags postgresql
OID: The object identifier (object ID) of the row. This field appears only when the table is created using the with OIDs, or when the Default_with_oids configuration parameter is set. The type of this field is the OID (with the same name as the field).
Example:
Copy Code code as follows:

CREATE TABLE Pg_language
(
Lanname name not NULL,
Lanowner OID not NULL,
LANISPL Boolean not NULL,
lanpltrusted Boolean not NULL,
Lanplcallfoid OID not NULL,
Lanvalidator OID not NULL,
Lanacl aclitem[]
)
With (
Oids=true
);

The OID is a 32-bit amount that is assigned to a common counter on the same cluster. For a large or long time database, this counter is likely to overlap. Therefore, it is very wrong to assume that the OID is the only one, unless you have taken steps to ensure that they are unique.
XID: Transaction ID, also a 32-bit amount. In a long-running database, it may overlap. There may be errors in the database after overlap, so steps need to be taken to resolve them. As long as we take some appropriate maintenance steps, this is not a very fatal problem. For example, we define doing vaccum. or manually reset.
Reset with the following command:
$ pg_resetxlog--help
The Pg_resetxlog command resets the PostgreSQL transaction log.
How to use:
Pg_resetxlog [OPTION] ... DataDir
Option parameters:
-e Xidepoch Set next transaction ID EPOCH
-F Enforce Mandatory update
-L TLI,FILE,SEG Force to set the minimum Wal start position of the new transaction log
-M XID set next multi transaction ID
-N Do not update, just take out the current control value, the experimental command
The-O OID sets the next OID, resetting the OID
-O Offset sets the next multi transaction ID OFFSET
-X XID sets the next transaction ID and resets XID
Writing so much about what's going on inside feels like it's still not clear. Oh!!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.