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 1hB4qJ-0002X5-C8 for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Apr 2019 21:51: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 1hB4qG-0004dE-JQ for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Apr 2019 21:51:44 +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 1hB4qG-0004d7-AX for pgsql-hackers@lists.postgresql.org; Mon, 01 Apr 2019 21:51:44 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hB4qC-0000Xa-Rg for pgsql-hackers@lists.postgresql.org; Mon, 01 Apr 2019 21:51:43 +0000 Received: by mail-qt1-x843.google.com with SMTP id w30so12615945qta.8 for ; Mon, 01 Apr 2019 14:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=hGbgxqu15a5KNcGFDOYLhBnZ/buVuUx2R6hoo0BMlmo=; b=L8WEo5YkOrivHnJC4aBUN0IOvzslzMSyThdQoqpdp+Myd0M0bKuKJBELAa9Bxht9ke ji4Tn43Oz9o99t787PzSoDXVNEIK2IIctgbm+LERE0+5C2XzXryRMCurj/QXmHy2oMq6 rV3P3PBoUhgDpVwo6Dm0oECr92tdr/8cx6ReRssXhm0ha5C5FsnBW7oFheRFZGa5pTsD JpiLvN23t9W11+5EvXAg5FpmAzKkbr7EcbihnmKTciQuLyNrQg75DR5Tej216NOw6/Nc znnqhEMOOaSwYWiF/MvEfqsRYC3MQ89ir26mNVT6Cbs49M1EueTc8j1HytOZZBMP3+Yh tItg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=hGbgxqu15a5KNcGFDOYLhBnZ/buVuUx2R6hoo0BMlmo=; b=t3ttycdICiZhAcdBgM7PYO4YvKAf/KIL1Gezex5eLQm5ZATNE3epLhnDkBxXtsOwBp WzAuJR2QVzMg3DrDk6XTpQShTucVsQNgvXSeEqUI122//lyFzKq3uwrbTzEivYb2c7pt Ov3AohlD8omx+XAyxU2XVRLqq44dks+uwe3sF3PqFwpmkuCizansLBJrXB6WNqHXfHb1 glTh8bjTJI+vZn+BLRGFzAGHRThVsGarTsKREKAEFAQZ+jU3WVe685d94wDvrCpZchFJ UXwE9FaMJmmQpBkvaxXDcMIvx0uUfZPhT2KdJZoBHyxZFsT/0bFCIJHy88uAkrHdMS+D 0Y7w== X-Gm-Message-State: APjAAAXhEb/r2nh+0PBR2jlhsDyxY8yMF8gJr2PkNomQQLPAc02CX19T agD/dF+MWfKXzKuDEkHUKtxkIw== X-Google-Smtp-Source: APXvYqxqoEFioN6q3Dy4nXrij2dRKp+gjbWaTeOpG5q2NHfAnTSzoee9Qu1KBVOXt/Hz3D9usxQP2w== X-Received: by 2002:aed:2a22:: with SMTP id c31mr57452261qtd.49.1554155497898; Mon, 01 Apr 2019 14:51:37 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id g15sm7422745qta.31.2019.04.01.14.51.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 14:51:37 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id A57B71210F5; Mon, 1 Apr 2019 18:51:35 -0300 (-03) Date: Mon, 1 Apr 2019 18:51:35 -0300 From: Alvaro Herrera To: Tom Lane Cc: Fabien COELHO , Tomas Vondra , Georgios Kokolatos , PostgreSQL Developers Subject: Re: CPU costs of random_zipfian in pgbench Message-ID: <20190401215135.GA31141@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <19055.1554154745@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 2019-Apr-01, Tom Lane wrote: > Fabien COELHO writes: > >> I was wondering about that too. It seems like it'd be a wise idea to > >> further constrain s and/or n to ensure that the s > 1 code path doesn't do > >> anything too awful ... > > > Yep. The attached version enforces s >= 1.001, which avoids the worse cost > > of iterating, according to my small tests. > > Seems reasonable. Pushed with minor documentation editing. Ah, so we now we can get rid of the TState * being passed around separately for expression execution, too? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services