> [!NOTE] ProjectSet > <table> > <tr> > <td width="25%"><img src="assets/ex_projectset.png"></td> > <td>Evaluates set-returning functions (SRFs) in the target list, such as <code>generate_series()</code> or <code>unnest()</code>. It emits multiple rows for each input row, effectively 'projecting' a set of values into the execution stream.</td> > </tr> > </table> > > ```sql > -- Expanding an array into multiple rows > EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE) > SELECT unnest(ARRAY[1,2,3]); > ``` > > ![ProjectSet Plan Tree](assets/plan_tree_op_project_set.svg) > > ```text > ProjectSet (cost=0.00..0.03 rows=3 width=4) (actual time=0.002..0.003 rows=3 loops=1) > Output: unnest('{1,2,3}'::integer[]) > -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.001 rows=1 loops=1) > Planning Time: 0.064 ms > Execution Time: 0.027 ms > ``` > > ![ProjectSet measured plan performance signature](assets/trace_op_project_set.svg) > > <table> > <tr> > <td rowspan="2" width="25%"><img src="assets/ex_projectset.svg"></td> > <td><b>Performance</b></td><td>High performance; overhead is tied directly to the complexity of the set-returning function.</td> > </tr> > <tr><td><b>Cost</b></td><td><code>`function cost + cpu_tuple_cost * number of rows`</code></td></tr> > </table>