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 1gvQKD-0005kf-F1 for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Feb 2019 17:33:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gvQKB-00072S-4q for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Feb 2019 17:33:55 +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 1gvQKA-00072L-U0 for pgsql-hackers@lists.postgresql.org; Sun, 17 Feb 2019 17:33:54 +0000 Received: from xvm-110-146.dc2.ghst.net ([46.226.110.146] helo=fetter.org) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gvQK3-0007bp-9K for pgsql-hackers@postgresql.org; Sun, 17 Feb 2019 17:33:54 +0000 Received: by fetter.org (Postfix, from userid 1001) id 596A440292; Sun, 17 Feb 2019 18:33:45 +0100 (CET) Date: Sun, 17 Feb 2019 18:33:45 +0100 From: David Fetter To: Tom Lane Cc: Fabien COELHO , Tomas Vondra , PostgreSQL Hackers Subject: Re: CPU costs of random_zipfian in pgbench Message-ID: <20190217173344.GY10435@fetter.org> References: <6065.1550419767@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6065.1550419767@sss.pgh.pa.us> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Feb 17, 2019 at 11:09:27AM -0500, Tom Lane wrote: > Fabien COELHO writes: > >> I'm trying to use random_zipfian() for benchmarking of skewed data sets, > >> and I ran head-first into an issue with rather excessive CPU costs. > > > If you want skewed but not especially zipfian, use exponential which is > > quite cheap. Also zipfian with a > 1.0 parameter does not have to compute > > the harmonic number, so it depends in the parameter. > > Maybe we should drop support for parameter values < 1.0, then. The idea > that pgbench is doing something so expensive as to require caching seems > flat-out insane from here. That cannot be seen as anything but a foot-gun > for unwary users. Under what circumstances would an informed user use > that random distribution rather than another far-cheaper-to-compute one? > > > ... This is why I submitted a pseudo-random permutation > > function, which alas does not get much momentum from committers. > > TBH, I think pgbench is now much too complex; it does not need more > features, especially not ones that need large caveats in the docs. > (What exactly is the point of having zipfian at all?) Taking a statistical perspective, Zipfian distributions violate some assumptions we make by assuming uniform distributions. This matters because Zipf-distributed data sets are quite common in real life. Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate