Re: UNION removes almost all rows (not duplicates) - in fresh build of pg17!

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: UNION removes almost all rows (not duplicates) - in fresh build of pg17!
Дата
Msg-id CAApHDvpDQh1NcL7nAsd3YAKj4vgORwesB3GYuNPnEXXRfA2g4w@mail.gmail.com
обсуждение исходный текст
Ответ на UNION removes almost all rows (not duplicates) - in fresh build of pg17!  (hubert depesz lubaczewski <depesz@depesz.com>)
Ответы Re: UNION removes almost all rows (not duplicates) - in fresh build of pg17!
Список pgsql-bugs
On Tue, 21 May 2024 at 04:00, hubert depesz lubaczewski
<depesz@depesz.com> wrote:
> $ explain (analyze) select count(*) from ( select * from pg_class where relkind = 'r' union select * from pg_class
whererelkind = 'i' );
 
>                                                               QUERY PLAN
>
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>  Aggregate  (cost=42.43..42.44 rows=1 width=8) (actual time=0.108..0.109 rows=1 loops=1)
>    ->  Unique  (cost=0.00..39.53 rows=232 width=236) (actual time=0.013..0.105 rows=1 loops=1)
>          ->  Append  (cost=0.00..39.53 rows=232 width=236) (actual time=0.012..0.099 rows=232 loops=1)
>                ->  Seq Scan on pg_class  (cost=0.00..19.19 rows=68 width=263) (actual time=0.012..0.058 rows=68
loops=1)
>                      Filter: (relkind = 'r'::"char")
>                      Rows Removed by Filter: 348
>                ->  Seq Scan on pg_class pg_class_1  (cost=0.00..19.19 rows=164 width=263) (actual time=0.002..0.030
rows=164loops=1)
 
>                      Filter: (relkind = 'i'::"char")
>                      Rows Removed by Filter: 252

Thanks for the report.

It looks like it's a very simple fix.  The problem is I wasn't setting
groupList when the grouping_is_sortable() returned false.  In the
prior version, make_union_unique() always set that.

The attached should apply cleanly up to d2a04470a.

David

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: [EXTERNAL] Re: Windows Application Issues | PostgreSQL | REF # 48475607
Следующее
От: "Haifang Wang (Centific Technologies Inc)"
Дата:
Сообщение: RE: [EXTERNAL] Re: Windows Application Issues | PostgreSQL | REF # 48475607