> [!NOTE] SetOp
> <table>
> <tr>
> <td width="25%"><img src="assets/ex_setop.png" style="width: 100%;"></td>
> <td>The <code>SetOp</code> node executes set-based logic on its children. For <code>INTERSECT</code> and <code>EXCEPT</code>, the engine compares rows from two sorted input streams to find matches or differences. This operator ensures that the result set adheres to the specific mathematical rules of the requested set operation.</td>
> </tr>
> </table>
>
> <table>
> <tr>
> <td rowspan="5" width="25%"><img src="assets/ex_setop.svg" style="width: 100%;"></td>
> <td><b>Performance</b></td><td>Requires sorted inputs; performance is proportional to the size of the combined result sets.</td>
> </tr>
> <tr><td><b>Factors</b></td><td>Operation type (INTERSECT/EXCEPT), sorting overhead, and the volume of duplicates.</td></tr>
> <tr><td><b>Cost</b></td><td><code>set operation cost * number of rows</code></td></tr>
> <tr><td><b>Operates on</b></td><td><a href="Structures/Result Set">Result Set</a></td></tr>
> <tr><td><b>Workloads</b></td><td><a href="Workloads/IO/BufFile/BufFileRead">IO: BufFileRead</a>, <a href="Workloads/IO/BufFile/BufFileWrite">IO: BufFileWrite</a>, <a href="Workloads/LWLock/Buffers/BufferContent">LWLock: BufferContent</a></td></tr>
> <tr><td colspan="3"><b>Description</b>: Performs set operations like INTERSECT and EXCEPT. (Note: <code>UNION ALL</code> uses <b>Append</b>).</td></tr>
> </table>