Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/release-18.sgml`
d05fc0e7b00243b2b62b5973811e23575ac0f12c5f3f59b10000000100000fa7
 UNIQUE indexes
-->

<listitem>
<para>
Ignore GROUP BY columns that are functionally dependent on other columns (Zhang Mingli, Jian He, David Rowley)
<ulink url="&commit_baseurl;bd10ec529">&sect;</ulink>
</para>

<para>
If a GROUP BY clause includes all columns of a unique index, as well as other columns of the same table, those other columns are redundant and can be dropped
from the grouping.  This was already true for non-deferred primary keys.
</para>
</listitem>

<!--
Author: Richard Guo <rguo@postgresql.org>
2024-10-09 [67a54b9e8] Allow pushdown of HAVING clauses with grouping sets
Author: Richard Guo <rguo@postgresql.org>
2024-09-10 [247dea89f] Introduce an RTE for the grouping step
Author: Richard Guo <rguo@postgresql.org>
2024-09-10 [f5050f795] Mark expressions nullable by grouping sets
Author: Richard Guo <rguo@postgresql.org>
2025-03-13 [cc5d98525] Fix incorrect handling of subquery pullup
-->

<listitem>
<para>
Allow some HAVING clauses on GROUPING SETS to be pushed to WHERE clauses (Richard Guo)
<ulink url="&commit_baseurl;67a54b9e8">&sect;</ulink>
<ulink url="&commit_baseurl;247dea89f">&sect;</ulink>
<ulink url="&commit_baseurl;f5050f795">&sect;</ulink>
<ulink url="&commit_baseurl;cc5d98525">&sect;</ulink>
</para>

<para>
This allows earlier row filtering.  This release also fixes some GROUPING SETS queries that used to return incorrect results.
</para>
</listitem>

<!--
Author: David Rowley <drowley@postgresql.org>
2024-07-09 [036bdcec9] Teach planner how to estimate rows for timestamp generat
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
2024-12-02 [97173536e] Add a planner support function for numeric generate_seri
-->

<listitem>
<para>
Improve row estimates for generate_series() using numeric and timestamp values (David Rowley, Song Jinzhou)
<ulink url="&commit_baseurl;036bdcec9">&sect;</ulink>
<ulink url="&commit_baseurl;97173536e">&sect;</ulink>
</para>
</listitem>

<!--
Author: Richard Guo <rguo@postgresql.org>
2024-07-05 [aa86129e1] Support "Right Semi Join" plan shapes
-->

<listitem>
<para>
Allow the optimizer to use "Right Semi Join" plans (Richard Guo)
<ulink url="&commit_baseurl;aa86129e1">&sect;</ulink>
</para>

<para>
Semi-joins are used when needing to find if there is at least one match.
</para>
</listitem>

<!--
Author: Richard Guo <rguo@postgresql.org>
2024-10-09 [828e94c9d] Consider explicit incremental sort for mergejoins
-->

<listitem>
<para>
Allow merge joins to use incremental sorts (Richard Guo)
<ulink url="&commit_baseurl;828e94c9d">&sect;</ulink>
</para>
</listitem>

<!--
Author: Amit Langote <amitlan@postgresql.org>
2025-04-04 [88f55bc97] Make derived clause lookup in EquivalenceClass more effi
Author: David Rowley <drowley@postgresql.org>
2025-04-08 [d69d45a5a] Speedup child EquivalenceMember lookup in planner
-->

<listitem>
<para>
Improve the efficiency of planning queries accessing many partitions (Ashutosh Bapat, Yuya Watari, David Rowley)
<ulink url="&commit_baseurl;88f55bc97">&sect;</ulink>
<ulink url="&commit_baseurl;d69d45a5a">&sect;</ulink>
</para>
</listitem>

<!--
Author: Richard Guo <rguo@postgresql.org>
2024-07-30 [9b282a935] Fix partitionwise join with partially-redundant join cla
Author: Richard Guo <rguo@postgresql.org>
2024-07-29 [513f4472a] Reduce memory used by partitionwise joins
-->

<listitem>
<para>
Allow partitionwise joins in more cases, and reduce its memory usage (Richard Guo, Tom Lane, Ashutosh Bapat)
<ulink url="&commit_baseurl;9b282a935">&sect;</ulink>
<ulink url="&commit_baseurl;513f4472a">&sect;</ulink>
</para>
</listitem>

<!--
Author: Alexander Korotkov <akorotkov@postgresql.org>
2025-03-10 [fae535da0] Teach Append to consider tuple_fraction when accumulatin
-->

<listitem>
<para>
Improve cost estimates of partition queries (Nikita Malakhov, Andrei Lepikhov)
<ulink url="&commit_baseurl;fae535da0">&sect;</ulink>
</para>
</listitem>

<!--
Author: Tom Lane <tgl@sss.pgh.pa.us>
2025-04-02 [0dca5d68d] Change SQL-language functions to use the plan cache.
Author:

Title: PostgreSQL 18: Optimizer Improvements - GROUP BY, HAVING, generate_series(), Semi Joins, Merge Joins, Partitioning, Cost Estimates, and SQL Functions
Summary
This section details further optimizer improvements in PostgreSQL 18, including allowing some HAVING clauses on GROUPING SETS to be pushed to WHERE clauses for earlier row filtering, improving row estimates for generate_series() using numeric and timestamp values, enabling the optimizer to use "Right Semi Join" plans, allowing merge joins to use incremental sorts, enhancing the efficiency of planning queries accessing many partitions, allowing partitionwise joins in more cases and reducing its memory usage, and improving cost estimates of partition queries.