April 2018
Intermediate to advanced
508 pages
15h 22m
English
In earlier versions of PostgreSQL, every database row had a unique object identification number (OID) that could be used to identify it. The overhead of storing these OIDs was considered too high, and, as of PostgreSQL 8.1, they now default to off. You can still include them in a table by specifying CREATE TABLE... WITH OIDS, and the system catalog tables include them. Using an OID to find a record works the same as any other indexed scan:
SELECT oid,relname FROM pg_class WHERE relname='customers';
oid | relname
-------+-----------
16736 | customers
EXPLAIN SELECT relname FROM pg_class WHERE oid=16736;
QUERY PLAN
-------------------
Index Scan using pg_class_oid_index on pg_class (cost=0.00..8.27 rows=1 width=64)
Index Cond: ...Read now
Unlock full access