pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Consider the "LIMIT 1" optimization with parallel DISTINCT
Date: Wed, 31 Jan 2024 04:22:20 +0000
Message-ID: <E1rV27A-003wQt-Rr@gemulon.postgresql.org> (raw)

Consider the "LIMIT 1" optimization with parallel DISTINCT

Similar to what was done in 5543677ec for non-parallel DISTINCT, apply
the same optimization when the distinct_pathkeys are empty for the
partial paths too.

This can be faster than the non-parallel version when the first row
matching the WHERE clause of the query takes a while to find.  Parallel
workers could speed that process up considerably.

Author: Richard Guo
Reviewed-by: David Rowley
Discussion: https://postgr.es/m/CAMbWs49JC0qvfUbzs-TVzgMpSSBiMJ_6sN=BaA9iohBgYkr=LA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b588cad688823b1e996ce05af4d88a954c005a3a

Modified Files
--------------
src/backend/optimizer/plan/planner.c          | 44 ++++++++++++++++++++++++---
src/test/regress/expected/select_distinct.out | 20 ++++++++++++
src/test/regress/sql/select_distinct.sql      | 13 ++++++++
3 files changed, 72 insertions(+), 5 deletions(-)



Message-ID: <E1rV27A-003wQt-Rr@gemulon.postgresql.org>
Permalink:  ../E1rV27A-003wQt-Rr@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rV27A-003wQt-Rr@gemulon.postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Consider the "LIMIT 1" optimization with parallel DISTINCT
  In-Reply-To: <E1rV27A-003wQt-Rr@gemulon.postgresql.org>

* 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