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 1gvUcC-0005mw-Ac for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Feb 2019 22:08:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gvUcA-0005ZL-C0 for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Feb 2019 22:08:46 +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 1gvUcA-0005ZD-12 for pgsql-hackers@lists.postgresql.org; Sun, 17 Feb 2019 22:08:46 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvUc1-0002Y5-Cs for pgsql-hackers@postgresql.org; Sun, 17 Feb 2019 22:08:44 +0000 Received: by mail-wr1-x441.google.com with SMTP id w2so1631001wrt.11 for ; Sun, 17 Feb 2019 14:08:37 -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=cJrIEeTJasN9CPkh8SMz8pcSRuU67IUfVQt4Zlssoog=; b=XxJSq0v0iaz5wKKsKqsnGmGFWZPKin8T81Keyx+LC0KwQDlZJ/C0nEAjI3L/8nuZes qtWJL20dufdjLyNXsk0Yn0uilMHDID5fTz8lvOr+Ss1o72fDDywLC2NGpc2QO4ApiS9S 1HL6le2/Butqpgitbo75A7RWoBbfQnofl83PCYRpBir22tJBEDYCUChgm0SwkGYmTkR/ F7Erc+D6txqQZ+LcgTXBM6Rm7JSwQgcLkCLZiEdoTNo8aZB2rJ+A2mk2y38OLmxYOqpH 4GYzLzlOpCMmT0+i+5PicEVDaWYrB8n16WHIHEf5X0lbSLsuyHBRgijCkPGAThE/69PP PZuw== 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=cJrIEeTJasN9CPkh8SMz8pcSRuU67IUfVQt4Zlssoog=; b=IDTg+6GrVg2VZYFypC+H29xQYpeVBR9VhnO8tPvWqrcsNbMouJzIrElUKIRjSR/Akm 7Z0RV9t7WGaxQLMyaM9FoADSoXxMkNkhcwApgUdddBIFVFg9ikd74/LUJNSSX+EzpG7N JudHrK9bqxuozMn0UZV8P8w/CTFHqkki0PHBpk3vLlv2ZtAPCgpfw3uB0AQxWFddQadT geVAVMfDCIEqP54YsQ06Qgan2AEW5i2isIrrlx2E/ZTJ62VyzFkHmnuThTHN69PrhcsG VBzhw0EvZuTCuy5N1FIsmrnACFfyXf5jKbPvmZw2Pbq60P/TpGlGeZP79hzU236mdFaw Vvvg== X-Gm-Message-State: AHQUAuZFMy/lJY/q5p3q0ZOtPGFjyViCqMnbo9Hbx9lokFQKBwZ8/BOS Pjqtz2N+1/hcCeNdUi97XsvUI7WCE9//LMXDdd28ZwlYIDVMPRBtYdV5wTAnA/qvko8tvpaCwi6 bR2feI1pGfPZCiB+Ha6Y5VFFcMPfrtHYTlKI0ZvhG8tuA8jSWtmo2mpz4KH60UHWk76nQ0UHQw9 DrduN5Fl6ayEc= X-Google-Smtp-Source: AHgI3IY3jxqYm5mUYxJ4SpQfnRg3qI0XnjXENROSe9aR33aqujP5pS8UOi+3zvbUVfwpKTIaFDQ8ow== X-Received: by 2002:a5d:4f11:: with SMTP id c17mr5666187wru.242.1550441314348; Sun, 17 Feb 2019 14:08:34 -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 c129sm9124381wma.48.2019.02.17.14.08.33 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sun, 17 Feb 2019 14:08:33 -0800 (PST) Subject: Re: CPU costs of random_zipfian in pgbench To: Tom Lane , Fabien COELHO Cc: PostgreSQL Hackers References: <6065.1550419767@sss.pgh.pa.us> From: Tomas Vondra Message-ID: <779980b4-a4a6-3bf9-7ecf-56cc9ce6f5be@2ndquadrant.com> Date: Sun, 17 Feb 2019 23:08:31 +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: <6065.1550419767@sss.pgh.pa.us> 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 5:09 PM, 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. Maybe. It's not quite clear to me why we support the two modes at all? We use one algorithm for values < 1.0 and another one for values > 1.0, what's the difference there? Are those distributions materially different? Also, I wonder if just dropping support for parameters < 1.0 would be enough, because the docs say: The function's performance is poor for parameter values close and above 1.0 and on a small range. which seems to suggest it might be slow even for values > 1.0 in some cases. Not sure. > 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?) > I wonder about the growing complexity of pgbench too ... regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services