Re: PG-10 + ICU and abbreviated keys

From: Adrien Nayrat <adrien(dot)nayrat(at)dalibo(dot)com>
To: Andreas Joseph Krogh <andreas(at)visena(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: PG-10 + ICU and abbreviated keys
Date: 2017-11-13 11:42:04
Message-ID: 411d0ed2-6c14-26b4-e7cc-f11f13c997ad@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/13/2017 09:27 AM, Andreas Joseph Krogh wrote:
>  
> In PG-10, with ICU enabled, is abbreviated keys now enabled?
>  

Hello,

I think yes :

src/backend/utils/adt/varlena.c

1876 /*
1877 * Unfortunately, it seems that abbreviation for non-C collations is
1878 * broken on many common platforms; testing of multiple versions of glibc
1879 * reveals that, for many locales, strcoll() and strxfrm() do not return
1880 * consistent results, which is fatal to this optimization. While no
1881 * other libc other than Cygwin has so far been shown to have a problem,
1882 * we take the conservative course of action for right now and disable
1883 * this categorically. (Users who are certain this isn't a problem on
1884 * their system can define TRUST_STRXFRM.)
1885 *
1886 * Even apart from the risk of broken locales, it's possible that there
1887 * are platforms where the use of abbreviated keys should be disabled at
1888 * compile time. Having only 4 byte datums could make worst-case
1889 * performance drastically more likely, for example. Moreover, macOS's
1890 * strxfrm() implementation is known to not effectively concentrate a
1891 * significant amount of entropy from the original string in earlier
1892 * transformed blobs. It's possible that other supported platforms are
1893 * similarly encumbered. So, if we ever get past disabling this
1894 * categorically, we may still want or need to disable it for particular
1895 * platforms.
1896 */
1897 #ifndef TRUST_STRXFRM
1898 if (!collate_c && !(locale && locale->provider == COLLPROVIDER_ICU))
1899 abbreviate = false;
1900 #endif

But I did not do any test to compare performances.

Regards,

--
Adrien NAYRAT

http://dalibo.com - http://dalibo.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-11-13 15:05:09 Re: PostgreSQL walsender process doesn't exist after "pg_ctl stop -m fast"
Previous Message Mark Morgan Lloyd 2017-11-13 11:11:17 Re: pg on Debian servers