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 1gvUWN-0005Vc-Am for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Feb 2019 22:02:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gvUWL-0007PP-UI for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Feb 2019 22:02:45 +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 1gvUWL-0007PI-Fc for pgsql-hackers@lists.postgresql.org; Sun, 17 Feb 2019 22:02:45 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvUWI-0002QJ-22 for pgsql-hackers@postgresql.org; Sun, 17 Feb 2019 22:02:44 +0000 Received: by mail-wm1-x341.google.com with SMTP id j125so15125233wmj.1 for ; Sun, 17 Feb 2019 14:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZjkMC6B3GJGH4XdYNiMu2uwXIBNUnof4ADeioQHTO8M=; b=zPSE8YKYLuWOaxKttzIm+Vni5YhHPrZbeXPrTZIH+8TC6ioIyAbh5mxSOsSuIcR+Mq emfFKHp7N7ZBvBrXyeL6m92MP2ULUIn8vFd/JAk6UyzOWJ+/qB7Giio3dWuVpRwCdjrp Et8jGYMrhH6SsezSNgZiyykXqWsTmG497/zb/fUmxe3UtqypqC39hrZkiRct1P5cY+e2 RVRiQPilnoo4fZvL95Rgrih6YEuqJIqzoSnJdjsD6vTr+No1Z65l0eSqbVe3qBtaifyI R8W8QD1tDfBwGDZ1bN3j/8oUEQZQXytseXGTiUCTyt0XTUi0+3453df9gPPfeCC4G5pX iGmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZjkMC6B3GJGH4XdYNiMu2uwXIBNUnof4ADeioQHTO8M=; b=W0NrQA+pCs0qVw/Y5Da/6eAoQd4lTUVZu32stginqHxF0CPsD6Kfd0rNxDZx1MylGc 4EKFDFxs629hOguam9xH23dSuN4WzGwUvnn0/bXyAsdYpNFQEwKizdwNBRsgN3+eAfRq ZpjMNSrUePUnSuIX6nfYfWRR8JscHKCWzRDkWT+NGiAtaLxCyR2zQSjCvoD1RY127nWk MKuOnCiwYS6VvO5Gh25OE74XSpagYOUR77Za2hlZvNwgf1lTG6RSVewHposQkzkNfA5U Pn0H4qkV5epDFKDffGM5hEqmjVN6XVy4JWDZPEyKbgoRDSjjUBODOlP/EdV8355ilwZq q9zA== X-Gm-Message-State: AHQUAubxyqU/mUDoVCcamZNttLtCo4zW73Ir14u6EUgQtkxJ7yDrXzII ZyUOA0NsssLEeyhwBVpRijhkcbh1KAGf3sv5TQeq3/cA/ZVewQuj3Qv6XgN42HEavLmf+IFgcvG eHc51GuEr5q6g30gmDX9gNqJARA2GIiris+f0j0IWD+51SQrp4zwfVh3Db7UMyB0amdR/lWhuGS TlfKDx6dMTkYs= X-Google-Smtp-Source: AHgI3IazsoKAFqqJzuHkMsYJNgRgDWX8HULzlVmfUAEcKtEn659Qzy4YNpY9IjdYp6JAFhmFBhetjA== X-Received: by 2002:a1c:ed0b:: with SMTP id l11mr13047895wmh.86.1550440960059; Sun, 17 Feb 2019 14:02:40 -0800 (PST) Received: from [10.137.0.17] (ip-86-49-246-90.net.upcbroadband.cz. [86.49.246.90]) by smtp.gmail.com with ESMTPSA id y20sm22859686wra.51.2019.02.17.14.02.38 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sun, 17 Feb 2019 14:02:39 -0800 (PST) Subject: Re: CPU costs of random_zipfian in pgbench To: David Fetter , Tom Lane Cc: Fabien COELHO , PostgreSQL Hackers References: <6065.1550419767@sss.pgh.pa.us> <20190217173344.GY10435@fetter.org> From: Tomas Vondra Message-ID: <0666abc4-1a41-7703-8fd8-244ac10243b4@2ndquadrant.com> Date: Sun, 17 Feb 2019 23:02:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190217173344.GY10435@fetter.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/17/19 6:33 PM, David Fetter wrote: > 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. > I don't think there's any disagreement about the value of non-uniform distributions. The question is whether it has to be a zipfian one, when the best algorithm we know about is this expensive in some cases? Or would an exponential distribution be enough? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services