diff options
| author | Bruce Momjian | 2005-01-30 02:06:33 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2005-01-30 02:06:33 +0000 |
| commit | 811df913405691a28b61e427b4c813855aff3a6d (patch) | |
| tree | f84d1fc75baa548a0d733fa60a667f426dced7d3 /doc/src | |
| parent | 64428b8daff77d6a4cab7fc108db057389481a3f (diff) | |
Update OID item description.
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/FAQ/FAQ.html | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/doc/src/FAQ/FAQ.html b/doc/src/FAQ/FAQ.html index ec6a92b960a..37e2ec37b4f 100644 --- a/doc/src/FAQ/FAQ.html +++ b/doc/src/FAQ/FAQ.html @@ -10,7 +10,7 @@ alink="#0000ff"> <H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1> - <P>Last updated: Wed Jan 19 14:45:22 EST 2005</P> + <P>Last updated: Sat Jan 29 21:05:17 EST 2005</P> <P>Current maintainer: Bruce Momjian (<A href= "mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR> @@ -1190,37 +1190,20 @@ BYTEA bytea variable-length byte array (null-byte safe) <H4><A name="4.15">4.15</A>) What is an <SMALL>OID</SMALL>? What is a <SMALL>TID</SMALL>?</H4> - <P><SMALL>OID</SMALL>s are PostgreSQL's answer to unique row ids. - Every row that is created in PostgreSQL gets a unique - <SMALL>OID</SMALL>. All <SMALL>OID</SMALL>s generated during - <I>initdb</I> are less than 16384 (from - <I>include/access/transam.h</I>). All user-created - <SMALL>OID</SMALL>s are equal to or greater than this. By default, - all these <SMALL>OID</SMALL>s are unique not only within a table or - database, but unique within the entire PostgreSQL installation.</P> - - <P>PostgreSQL uses <SMALL>OID</SMALL>s in its internal system - tables to link rows between tables. These <SMALL>OID</SMALL>s can - be used to identify specific user rows and used in joins. It is - recommended you use column type <SMALL>OID</SMALL> to store - <SMALL>OID</SMALL> values. You can create an index on the - <SMALL>OID</SMALL> field for faster access.</P> - - <P>O<SMALL>ID</SMALL>s are assigned to all new rows from a central - area that is used by all databases. If you want to change the - <SMALL>OID</SMALL> to something else, or if you want to make a copy - of the table, with the original <SMALL>OID</SMALL>s, there is no - reason you can't do it:</P> -<PRE> - CREATE TABLE new_table(mycol int); - SELECT oid AS old_oid, mycol INTO tmp_table FROM old_table; - COPY tmp_table TO '/tmp/pgtable'; - COPY new_table WITH OIDS FROM '/tmp/pgtable'; - DROP TABLE tmp_table; -</PRE> - <P>O<SMALL>ID</SMALL>s are stored as 4-byte integers, and will - overflow at 4 billion. No one has reported this ever happening, and - we plan to have the limit removed before anyone does.</P> + <P>Every row that is created in PostgreSQL gets a unique + <SMALL>OID</SMALL> unless created <SMALL>WITHOUT OIDS</SMALL>. + O<SMALL>ID</SMALL>s are autotomatically assigned unique 4-byte + integers that are unique across the entire installation. However, + they overflow at 4 billion, and then the O<SMALL>ID</SMALL>s start + being duplicated. PostgreSQL uses <SMALL>OID</SMALL>s to link its + internal system tables together.</P> + + <P>To uniquely number columns in user tables, it is best to use + <SMALL>SERIAL</> rather than O<SMALL>ID</SMALL>s because + <SMALL>SERIAL<SMALL> sequences are unique only within a single + table. and are therefore less likely to overflow. + <SMALL>SERIAL8</SMALL> is available for storing eight-byte sequence + values.</P> <P>T<SMALL>ID</SMALL>s are used to identify specific physical rows with block and offset values. T<SMALL>ID</SMALL>s change after rows |
