### Tid Scan ![[assets/ex_tidscan.png|256]] ### The Explain Trace ```sql -- Fetching a tuple directly by its block and offset EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE) SELECT * FROM animals WHERE ctid = '(0,1)'; ``` ```text Tid Scan on public.animals (cost=1.00..5.01 rows=1 width=27) (actual time=1.004..1.004 rows=1 loops=1) Output: id, name, species_id, created_at TID Cond: (animals.ctid = '(0,1)'::tid) Buffers: shared hit=1 ``` --- - **Description**: Scans a table using tuple IDs. - **Performance**: The highest performance possible for a single-row lookup; bypasses the index entirely to perform a single-page read. - **Factors**: Number of tuple IDs and whether the physical location is known in advance. - **Cost**: `cpu_tuple_cost * number of tuple IDs` ![[assets/ex_tid_scan.svg|256]] - **Operates on**: [[Structures/Tuple]] - **Workloads**: - [[Workloads/IO/DataFile/DataFileRead|IO: DataFileRead]] - [[Workloads/LWLock/Buffers/BufferContent|LWLock: BufferContent]]