### Subquery Scan
![[assets/ex_subqueryscan.png|256]]
### The Explain Trace
```sql
-- Conceptual plan for a non-inlinable subquery
EXPLAIN SELECT * FROM (
SELECT id FROM animals
OFFSET 0 -- Prevents pull-up in some versions/cases
) s;
```
```text
Subquery Scan on s (cost=1.00..548.00 rows=20000 width=4)
-> Seq Scan on animals (cost=1.00..348.00 rows=20000 width=4)
```
---
- **Description**: Scans the result of a subquery.
- **Performance**: High performance; essentially a pass-through node for subqueries that the optimizer cannot flatten into the outer query.
- **Factors**: Subquery complexity and the total number of rows processed.
- **Cost**: Equivalent to the cost of the child subquery plan.
![[assets/ex_subplan.svg|256]]
- **Operates on**: [[Structures/Result Set]]
- **Workloads**:
- [[Workloads/LWLock/Buffers/BufferContent|LWLock: BufferContent]]