### Table Function Scan
![[assets/ex_tablefuncscan.png|256]]
### The Explain Trace
```sql
-- Querying a generated XML table
EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE)
SELECT * FROM xmltable('/root/item'
PASSING '<root><item>1</item><item>2</item></root>'
COLUMNS i int PATH '.');
```
```text
Table Function Scan on "xmltable" (cost=1.00..2.00 rows=100 width=4) (actual time=1.034..1.035 rows=2 loops=1)
Output: i
Planning Time: 1.055 ms
Execution Time: 1.063 ms
```
---
- **Description**: Scans the output of a table function (e.g., `xmltable`).
- **Performance**: Depends on the complexity and volume of the generated table.
- **Factors**: Function logic, input size, and the depth of the XML/JSON parsing.
- **Cost**: `function cost + cpu_tuple_cost * number of rows`
![[assets/ex_table_func_scan.svg|256]]
- **Operates on**: [[Structures/Table]]
- **Workloads**:
- [[Workloads/IO/BufFile/BufFileRead|IO: BufFileRead]]
- [[Workloads/LWLock/Buffers/BufferContent|LWLock: BufferContent]]