1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.90 2002/04/2502:56:55 tgl Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.91 2002/04/2520:14:43 tgl Exp $
3
3
-->
4
4
5
5
<chapter id="datatype">
@@ -2924,6 +2924,18 @@ SELECT SUBSTRING(b FROM 1 FOR 2) FROM test;
2924
2924
<primary>regtype</primary>
2925
2925
</indexterm>
2926
2926
2927
+ <indexterm zone="datatype-oid">
2928
+ <primary>xid</primary>
2929
+ </indexterm>
2930
+
2931
+ <indexterm zone="datatype-oid">
2932
+ <primary>cid</primary>
2933
+ </indexterm>
2934
+
2935
+ <indexterm zone="datatype-oid">
2936
+ <primary>tid</primary>
2937
+ </indexterm>
2938
+
2927
2939
<para>
2928
2940
Object identifiers (OIDs) are used internally by
2929
2941
<productname>PostgreSQL</productname> as primary keys for various system
@@ -3034,7 +3046,7 @@ SELECT SUBSTRING(b FROM 1 FOR 2) FROM test;
3034
3046
</para>
3035
3047
3036
3048
<para>
3037
- All of the alias types accept schema-qualified names, and will
3049
+ All of theOID alias types accept schema-qualified names, and will
3038
3050
display schema-qualified names on output if the object would not
3039
3051
be found in the current search path without being qualified.
3040
3052
The <type>regproc</> and <type>regoper</> alias types will only
@@ -3045,6 +3057,52 @@ SELECT SUBSTRING(b FROM 1 FOR 2) FROM test;
3045
3057
operand.
3046
3058
</para>
3047
3059
3060
+ <para>
3061
+ OIDs are 32-bit quantities and are assigned from a single cluster-wide
3062
+ counter. In a large or long-lived database, it is possible for the
3063
+ counter to wrap around. Hence, it is bad practice to assume that OIDs
3064
+ are unique, unless you take steps to ensure that they are unique.
3065
+ Recommended practice when using OIDs for row identification is to create
3066
+ a unique constraint on the OID column of each table for which the OID will
3067
+ be used. Never assume that OIDs are unique across tables; use the
3068
+ combination of <structfield>tableoid</> and row OID if you need a
3069
+ database-wide identifier. (Future releases of
3070
+ <productname>PostgreSQL</productname> are likely to use a separate
3071
+ OID counter for each table, so that <structfield>tableoid</>
3072
+ <emphasis>must</> be included to arrive at a globally unique identifier.)
3073
+ </para>
3074
+
3075
+ <para>
3076
+ Another identifier type used by the system is <type>xid</>, or transaction
3077
+ (abbreviated xact) identifier. This is the datatype of the system columns
3078
+ <structfield>xmin</> and <structfield>xmax</>.
3079
+ Transaction identifiers are 32-bit quantities. In a long-lived
3080
+ database it is possible for transaction IDs to wrap around. This
3081
+ is not a fatal problem given appropriate maintenance procedures;
3082
+ see the <citetitle>Administrator's Guide</> for details. However, it is
3083
+ unwise to depend on uniqueness of transaction IDs over the long term
3084
+ (more than one billion transactions).
3085
+ </para>
3086
+
3087
+ <para>
3088
+ A third identifier type used by the system is <type>cid</>, or command
3089
+ identifier. This is the datatype of the system columns
3090
+ <structfield>cmin</> and <structfield>cmax</>.
3091
+ Command identifiers are also 32-bit quantities. This creates a hard
3092
+ limit of 2<superscript>32</> (4 billion) SQL commands within a single
3093
+ transaction.
3094
+ In practice this limit is not a problem --- note that the limit is on
3095
+ number of SQL queries, not number of tuples processed.
3096
+ </para>
3097
+
3098
+ <para>
3099
+ A final identifier type used by the system is <type>tid</>, or tuple
3100
+ identifier. This is the datatype of the system column
3101
+ <structfield>ctid</>. A tuple ID is a pair
3102
+ (block number, tuple index within block) that identifies the
3103
+ physical location of the tuple within its table.
3104
+ </para>
3105
+
3048
3106
</sect1>
3049
3107
3050
3108
</chapter>