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!!