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 1grIjZ-0008RB-Fk for pgsql-performance@arkaria.postgresql.org; Wed, 06 Feb 2019 08:39:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1grIjY-0005RZ-3J for pgsql-performance@arkaria.postgresql.org; Wed, 06 Feb 2019 08:39:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1grIjX-0005Qr-O6 for pgsql-performance@lists.postgresql.org; Wed, 06 Feb 2019 08:39:03 +0000 Received: from mx2a.mailbox.org ([2001:67c:2050:104:0:2:25:2] helo=mx2.mailbox.org) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1grIjU-0005De-BU for pgsql-performance@lists.postgresql.org; Wed, 06 Feb 2019 08:39:02 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 3CB42A1DA3; Wed, 6 Feb 2019 09:38:53 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id 0Ob5sEWD3Ooc; Wed, 6 Feb 2019 09:38:44 +0100 (CET) Message-ID: Subject: Re: How can sort performance be so different From: Laurenz Albe To: Merlin Moncure , Bob Jolliffe Cc: Peter Geoghegan , pgsql-performance@lists.postgresql.org Date: Wed, 06 Feb 2019 09:38:42 +0100 In-Reply-To: References: <14004.1548787651@sss.pgh.pa.us> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Merlin Moncure wrote: > yeah, probably. Having said that, I'm really struggling that it can > take take several minutes to sort such a small number of rows even > with location issues. I can sort rocks faster than that :-). > > Switching between various european collations, I'm seeing subsecond > sort responses for 44k records on my test box. I don't have the laos > collation installed unfortunately. Are you seeing kind of penalty in > other conversions? I find that it makes a lot of difference what you sort: CREATE TABLE sort(t text); INSERT INTO sort SELECT 'ຕົວອັກສອນລາວ... ງ່າຍຂື້ນ' || i FROM generate_series(1, 100000) AS i; SET work_mem = '1GB'; EXPLAIN (ANALYZE, BUFFERS) SELECT t FROM sort ORDER BY t COLLATE "C"; [...] Execution Time: 288.752 ms EXPLAIN (ANALYZE, BUFFERS) SELECT t FROM sort ORDER BY t COLLATE "lo_LA.utf8"; [...] Execution Time: 47006.683 ms EXPLAIN (ANALYZE, BUFFERS) SELECT t FROM sort ORDER BY t COLLATE "en_US.utf8"; [...] Execution Time: 73962.934 ms CREATE TABLE sort2(t text); INSERT INTO sort2 SELECT 'this is plain old English' || i FROM generate_series(1, 100000) AS i; SET work_mem = '1GB'; EXPLAIN (ANALYZE, BUFFERS) SELECT t FROM sort2 ORDER BY t COLLATE "C"; [...] Execution Time: 237.615 ms EXPLAIN (ANALYZE, BUFFERS) SELECT t FROM sort2 ORDER BY t COLLATE "lo_LA.utf8"; [...] Execution Time: 2467.848 ms EXPLAIN (ANALYZE, BUFFERS) SELECT t FROM sort2 ORDER BY t COLLATE "en_US.utf8"; [...] Execution Time: 2927.667 ms This is on my x86_64 Fedora 29 system, kernel 4.20.6, glibc 2.28. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com