Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fDWDJ-00073D-75 for pgsql-pkg-debian@arkaria.postgresql.org; Tue, 01 May 2018 14:25: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 1fDWDH-0002QA-PE for pgsql-pkg-debian@arkaria.postgresql.org; Tue, 01 May 2018 14:25:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fDWDH-0002Pu-Gm for pgsql-pkg-debian@lists.postgresql.org; Tue, 01 May 2018 14:25:03 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fDWDD-0006iT-PF for pgsql-pkg-debian@postgresql.org; Tue, 01 May 2018 14:25:02 +0000 Received: from msg.df7cb.de (unknown [IPv6:2a02:908:147b:4ae0:76e5:bff:fef3:7e00]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 40b3Zv66Rvz3Dyn; Tue, 1 May 2018 16:24:55 +0200 (CEST) Date: Tue, 1 May 2018 16:24:55 +0200 From: Christoph Berg To: Marc Cousin Cc: pgsql-pkg-debian@postgresql.org Subject: Re: libuuid performance impact Message-ID: <20180501142455.GA3019@msg.df7cb.de> Mail-Followup-To: Christoph Berg , Marc Cousin , pgsql-pkg-debian@postgresql.org References: <4f125945-e979-1f9e-a39b-a4bf5a4eca6b@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4f125945-e979-1f9e-a39b-a4bf5a4eca6b@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Re: Marc Cousin 2018-04-30 <4f125945-e979-1f9e-a39b-a4bf5a4eca6b@gmail.com> > Hi > > I've been investigating a performance "problem" with uuid generation > https://jasonaowen.net/blog/2017/Apr/13/benchmarking-uuids-v2/, which I > couldn't reproduce on my computer while it occurred on my servers. After > a few tests, it seems to come from uuid-ossp being replaced with > libuuid… when linking postgresql with uuid-ossp I get the exact same > performance between uuid_generate_v4 and gen_random_uuid. When linking > with libuuid, I get the same results as those displayed in the linked > webpage (I can provide numbers). > > Is this an expected difference ? It also depends which uuid "version" you are generating" =# explain analyze select uuid_generate_v1() from generate_series(1, 1000000); Function Scan on generate_series (cost=0.00..12.50 rows=1000 width=16) (actual time=129.701..6847.020 rows=1000000 loops=1) Planning time: 0.071 ms Execution time: 6921.871 ms =# explain analyze select uuid_generate_v4() from generate_series(1, 1000000); Function Scan on generate_series (cost=0.00..12.50 rows=1000 width=16) (actual time=123.784..5164.752 rows=1000000 loops=1) Planning time: 0.073 ms Execution time: 5203.226 ms =# explain analyze select gen_random_uuid() from generate_series(1, 1000000); QUERY PLAN Function Scan on generate_series (cost=0.00..12.50 rows=1000 width=16) (actual time=121.428..1908.190 rows=1000000 loops=1) Planning time: 0.070 ms Execution time: 1947.951 ms I can't say if this is expected, or if the libuuid performance is just worse, or if maybe the libuuid UUIDs are generated using stronger crypto. Is that performance difference a problem for you in practise? Christoph