pgsql: Consider the "LIMIT 1" optimization with parallel DISTINCT

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Consider the "LIMIT 1" optimization with parallel DISTINCT
Date: 2024-01-31 04:22:20
Message-ID: E1rV27A-003wQt-Rr@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2024-01-31 06:08:03 pgsql: Add tests for int4_bool() in int.c
Previous Message Michael Paquier 2024-01-31 04:17:19 pgsql: Fix various issues with ALTER TEXT SEARCH CONFIGURATION