> [!NOTE] Table Function Scan
> <table>
> <tr>
> <td width="25%"><img src="assets/ex_tablefuncscan.png"></td>
> <td>Executes functions that return a set of rows (e.g., <code>xmltable</code> or <code>jsonb_to_recordset</code>). The engine calls the function and then treats its output as a virtual table that can be scanned, filtered, or joined like any other relation.</td>
> </tr>
> </table>
>
> ```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
> ```
>
> <table>
> <tr>
> <td rowspan="5" width="25%"><img src="assets/ex_table_func_scan.svg"></td>
> <td><b>Performance</b></td><td>Depends on the complexity and volume of the generated table.</td>
> </tr>
> <tr><td><b>Factors</b></td><td>Function logic, input size, and the depth of the XML/JSON parsing.</td></tr>
> <tr><td><b>Cost</b></td><td><code>function cost + cpu_tuple_cost * number of rows</code></td></tr>
> <tr><td><b>Operates on</b></td><td><a href="Structures/Table">Table</a></td></tr>
> <tr><td><b>Workloads</b></td><td><a href="Workloads/IO/BufFile/BufFileRead">IO: BufFileRead</a>, <a href="Workloads/LWLock/Buffers/BufferContent">LWLock: BufferContent</a></td></tr>
> <tr><td colspan="3"><b>Description</b>: Scans the output of a table function (e.g., <code>xmltable</code>).</td></tr>
> </table>