Tuple id
Each row in the database has a tuple id, a number visible as the system column named ctid
in each row. You can use these to look up a row:
SELECT ctid,customerid FROM customers limit 3; ctid | customerid -------+------------ (0,1) | 1 (0,2) | 2 (0,3) | 3 EXPLAIN SELECT customerid FROM customers WHERE ctid='(0,1)'; QUERY PLAN --------------------------------------------------------- Tid Scan on customers (cost=0.00..4.01 rows=1 width=4) TID Cond: (ctid = '(0,1)'::tid)
These TID sequences cannot be relied upon as a stable way to access a particular row outside of a transaction, because common operations including UPDATE
will change them. If you're referring to a row more than one in the same transaction, perhaps in a procedural programming language, the TID scan can be a quick way to operate a second time on a row located earlier. The ctid
value can also be used to...