Consider the "LIMIT 1" optimization with parallel DISTINCT
David Rowley <drowley@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/plan/planner.c | modified | +39 −5 |
| src/test/regress/expected/select_distinct.out | modified | +20 −0 |
| src/test/regress/sql/select_distinct.sql | modified | +13 −0 |
Discussion
- Apply the "LIMIT 1" optimization to partial DISTINCT 4 messages · 2024-01-26 → 2024-01-31