pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Subject: Missing docs for new enable_group_by_reordering GUC
Date: Mon, 17 Jun 2024 22:32:56 -0400
Message-ID: <ZnDx2FYlba_OafQd@momjian.us> (raw)

This commit added enable_group_by_reordering:

	commit 0452b461bc4
	Author: Alexander Korotkov <akorotkov@postgresql.org>
	Date:   Sun Jan 21 22:21:36 2024 +0200
	
	    Explore alternative orderings of group-by pathkeys during optimization.
	
	    When evaluating a query with a multi-column GROUP BY clause, we can minimize
	    sort operations or avoid them if we synchronize the order of GROUP BY clauses
	    with the ORDER BY sort clause or sort order, which comes from the underlying
	    query tree. Grouping does not imply any ordering, so we can compare
	    the keys in arbitrary order, and a Hash Agg leverages this. But for Group Agg,
	    we simply compared keys in the order specified in the query. This commit
	    explores alternative ordering of the keys, trying to find a cheaper one.
	
	    The ordering of group keys may interact with other parts of the query, some of
	    which may not be known while planning the grouping. For example, there may be
	    an explicit ORDER BY clause or some other ordering-dependent operation higher up
	    in the query, and using the same ordering may allow using either incremental
	    sort or even eliminating the sort entirely.
	
	    The patch always keeps the ordering specified in the query, assuming the user
	    might have additional insights.
	
	    This introduces a new GUC enable_group_by_reordering so that the optimization
	    may be disabled if needed.
	
	    Discussion: https://postgr.es/m/7c79e6a5-8597-74e8-0671-1c39d124c9d6%40sigaev.ru
	    Author: Andrei Lepikhov, Teodor Sigaev
	    Reviewed-by: Tomas Vondra, Claudio Freire, Gavin Flower, Dmitry Dolgov
	    Reviewed-by: Robert Haas, Pavel Borisov, David Rowley, Zhihong Yu
	    Reviewed-by: Tom Lane, Alexander Korotkov, Richard Guo, Alena Rybakina

It mentions it was added as a GUC to postgresql.conf, but I see no SGML
docs for this new GUC value.  Would someone please add docs for this? 
Thanks.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.





view thread (8+ messages)  latest in thread

Message-ID: <ZnDx2FYlba_OafQd@momjian.us>
Permalink:  ../ZnDx2FYlba_OafQd@momjian.us/
Also on:    postgresql.org/message-id/ZnDx2FYlba_OafQd@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: bruce@momjian.us, aekorotkov@gmail.com
  Subject: Re: Missing docs for new enable_group_by_reordering GUC
  In-Reply-To: <ZnDx2FYlba_OafQd@momjian.us>
  References: <ZnDx2FYlba_OafQd@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox