Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifKuX-0007hW-G9 for pgsql-general@arkaria.postgresql.org; Thu, 12 Dec 2019 09:37:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ifKuV-0002gU-0m for pgsql-general@arkaria.postgresql.org; Thu, 12 Dec 2019 09:37:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifKuU-0002g4-JL for pgsql-general@lists.postgresql.org; Thu, 12 Dec 2019 09:37:26 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifKuN-0003zx-Gj for pgsql-general@lists.postgresql.org; Thu, 12 Dec 2019 09:37:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1576143436; bh=6G/FFe1R+1PVFBO0VXhgLZeuUX+2lbWCzQfJKrk3VqY=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=GwkT9BtBH6Vr0jvAxr6xItX7zdEZDgA4zIY54QnRM4WCgdetHWP3CdyiWmtGfhUN8 HmJAe8zTxPwIuNbHb1q1bl+xdZP5w2BhPTOBRV2V68xpBgvS/0n+1Q7ROCsP9NlEQS y5DYUzby6bg31tfBw+iVWD9+MtZAQRYgzgzSjVn4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([78.55.194.199]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mi2Nv-1i2Abi2kvR-00e5vn for ; Thu, 12 Dec 2019 10:37:16 +0100 Received: from ncq by hermes with local (Exim 4.92) (envelope-from ) id 1ifKuH-0001Ki-Ki for pgsql-general@lists.postgresql.org; Thu, 12 Dec 2019 10:37:13 +0100 Date: Thu, 12 Dec 2019 10:37:13 +0100 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: Encoding/collation question Message-ID: <20191212093713.GA3164@hermes.hilbert.loc> References: <24866.1576092317@sss.pgh.pa.us> <875zimb0j8.fsf@news-spur.riddles.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875zimb0j8.fsf@news-spur.riddles.org.uk> Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) User-Agent: Mutt/1.10.1 (2018-07-13) Sender: X-Provags-ID: V03:K1:7ByMQ++qaJPbOMBBBizj31pNf+Ff8n2KMXwKeoXa98bqdkNLjqf GBJAaeIGc/XzHd+aANtQvxDTob21IKgPzdqgdYHbQT/JTP/CWBn6xupRCbPouryZ8unHnkI y5e4ovF+Ip3yMg93JvLoRjbL0JIoMcTiGyoeQGF9rDRZLFDoY8CWQnU5SUQ02+bOKvNz6gs lBJ+n49eAwxZlgwuQZ7ag== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:O0oQ7maW1nQ=:/wCQfYORwxR4mWQizzItvW O2mgRVrikywuGkVMi+E3o9kI1Z9EbEaGvJZbdzFMhD0KvHH1Kc0+Q/DWXzU72mEYafbiecLNQ c4GOSxhaOCHTT2oCzsKoZKuFEsRAerqRbbxh8GB1p8BVhT4mQncDD6zkYOkCOfqp5uIJ5AHWo /5VEmdvPPi1fAiLRceIDbedjI3WcDONrICteem7UHpfmyuOdT+IWt7a5+Zq0on97u5rBU0cxs BXkyrQ8mAtoLpyn120OS6pwCBMqpc042AaEubXTUOLydpGWTRPqb9xVCS+sNe/RwT39BysfCx 099JyVczkd9SOVBYEYYm/alzBX27940XyLODs9VfuyCFe/0mFriY0ATexvd3qWPmcwOMaqcUm EBgzpO1hmX8V21Tvsr8uhh4Cq/ZoR7SlYle3CmB+5A9oJHdJ5TsqwAs6tmB4Ik+06oCXNNvyt 9xk81N2ILheyx9LVBW1gjQSbMIt76+Kx8mCwYJqd0xMpl8Xqw63y7qrBvPhwBovVEuYWXKN0b XcekYDqhF1ibFsFGy0fFOAVDvDdI41Iux7yecFbdOY/b53INma+BMtoQB6y6rS9xfbDvQ0Fko f9LMcsVc1U/SZgyAaXvzfyOhrSng1ie3VncZ+Fa8xnxJiHZ9Unj8KBunOIDLraVwST4y3DeqA 5irGLmLTdJFCRtWWcxXscQdD9l7/rVFyf30HS63w/U7UxKuaOuyURfOy3G0PaMtocXrVU60ib QtrM5hIDN2C6c/ASuaN6UP9JFLxzbpjetEygoJg7rNsBxi0dnKeuTkBtZVAxH3jG3+C38U8ah bF2SyVG4oW58nheQX209nOXoo7QNspBTRLgqQymgialXWsFNPkZnXrz6j4DANgmNY61WLbNK4 ZjVDm861lfEf7ORsAmazQw3YnT2PlLLm5LlE3Ubx2cZdrJT6U9ktFTk1dDiL3jx4p2/Fw1GE7 GAzxUe/JjCT0jKBnwFfTIdEsipjwaEFp2exqK5P8+kuzWgRwE9utA3gQa6UNJ1WvVEHuaVNes bJEcF+71T8yC0ld8eozrqw0a5tiZ/+aIV+5JebKuDKSdHwAc74DeAoEsOJ+dGwMKwxq71Qz/q iq6rfgA5vFdxa5HsM1R/mPiMEVUeLUTgAJZ36SSHuxXiWqtOwqzxX+fupMWxzD2UWBNYAg0yN YucBQSO6u820pE/DO9umUiF7OyE2tJczHHigXjruK6zOT7RFy5MUpIkEGrEM/FN0vrdankvry w87W+HaUFRF9SLgAReBM9FA37pKsId9iVYioxcgjL+Aa/jsgwZVnbfbYm6hU= Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Dec 12, 2019 at 05:03:59AM +0000, Andrew Gierth wrote: > Rich> I doubt that my use will notice meaningful differences. Since > Rich> there are only two or three databases in UTF8 and its collation > Rich> perhaps I'll convert those to LATIN1 and C. > > Note that it's perfectly fine to use UTF8 encoding and C collation (this > has the effect of sorting strings in Unicode codepoint order); this is > as fast for comparisons as LATIN1/C is. > > For those cases where you need data to be sorted in a > culturally-meaningful order rather than in codepoint order, you can set > collations on specific columns or in individual queries. Nice, thanks for pointing that out. One addition: while this may seem like "the" magic bullet it should be noted that one will need additional indexes for culturally-meaningful ORDER BY sorts to be fast (while having a default non-C collation one will get a by-default culturally-meaningful index for that one non-C locale). Question: is C collation expected to be future-proof / rock-solid /stable -- like UTF8 for encoding choice -- or could it end up like the SQL-ASCII encoding did: Yeah, we support it, it's been in use a long time, it should work, but, nah, one doesn't really want to choose it over UTF8 if at all possible, or at least know *exactly* what one is doing and BTW YMMV ? Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B