Therefore, the total memory used could be many times the value
        of <code class="varname">work_mem</code>; it is necessary to keep this
        fact in mind when choosing the value.  Sort operations are used
        for <code class="literal">ORDER BY</code>, <code class="literal">DISTINCT</code>,
        and merge joins.
        Hash tables are used in hash joins, hash-based aggregation, memoize
        nodes and hash-based processing of <code class="literal">IN</code> subqueries.
       </p><p>
     