Re: GUCs to control abbreviated sort keys

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: GUCs to control abbreviated sort keys
Дата
Msg-id CA+TgmoZ3FUJFJ+pfzZ8gPZiPHXKU01mBKBuWcc8YGPScjYGTxg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: GUCs to control abbreviated sort keys  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-hackers
On Wed, Jan 25, 2023 at 4:16 PM Jeff Davis <pgsql@j-davis.com> wrote:
> $ perl text_generator.pl 10000000 10 > /tmp/strings.txt
>
> CREATE TABLE s (t TEXT);
> COPY s FROM '/tmp/strings.txt';
> VACUUM FREEZE s;
> CHECKPOINT;
> SET work_mem='10GB';
> SET max_parallel_workers = 0;
> SET max_parallel_workers_per_gather = 0;
>
> SET sort_abbreviated_keys = false;
> EXPLAIN ANALYZE SELECT t FROM s ORDER BY t COLLATE "en-US-x-icu";
> -- 20875ms
>
> SET sort_abbreviated_keys = true;
> EXPLAIN ANALYZE SELECT t FROM s ORDER BY t COLLATE "en-US-x-icu";
> -- 22931ms
>
> Regression for abbreviated keys optimization in this case: 9.8%

That's interesting. Do you have any idea why this happens?

I've been a bit busy the last few days so haven't had a chance to look
at the test case until now. It seems like it's just a lorum ipsum
generator, except that each line is made to contain a random number of
words, and certain letters from the Latin alphabet are replaced with
other symbols. But why is that a problem for abbreviated keys? The
most obvious way for things to go wrong is for the first 8 bytes of
the strxfrm() blob to be very low-entropy, but it's not really clear
to me what about your test case would make that more likely. I guess
another explanation could be if having a few non-ASCII characters
mixed into the string makes strxfrm() a lot slower.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: Mikhail Gribkov
Дата:
Сообщение: Re: GUC for temporarily disabling event triggers
Следующее
От: vignesh C
Дата:
Сообщение: Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication