Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZfc2-0002MN-3H for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2018 16:21:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZfc1-0005Ma-La for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2018 16:21:53 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eZfc1-0005MQ-8k for pgsql-hackers@lists.postgresql.org; Thu, 11 Jan 2018 16:21:53 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eZfby-0003c3-1T for pgsql-hackers@postgresql.org; Thu, 11 Jan 2018 16:21:52 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id AB66621C1C40; Thu, 11 Jan 2018 19:21:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from zilders-MacBook-Pro.local (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 6F7D421C1751; Thu, 11 Jan 2018 19:21:47 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1515687707; bh=jxWQA8ThIKAkDrDOA9k/Qw3o1pdSKqwO/r4gXuq3IbM=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=XaMagfBSZxwyg33tQQ92ge81nrg1hrqeRIUq+fJhVe2bPyvj25CGT0+QSPG/jsEz4 psGQNwcF4SgmSg8YjepZFI453YERHafDSPoY682VibawYx7sdRO9huj3q490MeWX7j NUoS7kerLvM/5tQitbpZjBCAFcxtOuzElnb0BZcM= Subject: Re: General purpose hashing func in pgbench To: Fabien COELHO Cc: pgsql-hackers References: <0e8bd39e-dfcd-2879-f88f-272799ad7ef2@postgrespro.ru> <699225ee-c30c-b22e-4028-415e9eab26b2@postgrespro.ru> <80e9c570-5c49-1a01-f309-3d8d0cbbae42@postgrespro.ru> <38f1503e-7b63-4612-24a9-041af25bb022@postgrespro.ru> <9603bac9-ae5d-36c5-5978-a88bdb700e37@postgrespro.ru> <63f5a6ac-0c5b-8d59-ca8b-fc8e11244a66@postgrespro.ru> From: Ildar Musin Message-ID: <291822a3-0b3a-0b21-c694-c10776f516ac@postgrespro.ru> Date: Thu, 11 Jan 2018 19:21:46 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 10/01/2018 21:42, Fabien COELHO пишет: > > Hmm. I do not think that we should want a shared seed value. The seed > should be different for each call so as to avoid undesired > correlations. If wanted, correlation could be obtained by using an > explicit identical seed. > > ISTM that the best way to add the seed is to call random() when the > second arg is missing in make_func. Also, this means that the executor > would always get its two arguments, so it would simplify the code there. > Ok, I think I understand what you meant. You meant the case like following: \set x random(1, 100) \set h1 hash(:x) \set h2 hash(:x)  -- will have different seed from h1 so that different instances of hash function within one script would have different seeds. Yes, that is a good idea, I can do that. -- Ildar Musin Postgres Professional: http://www.postgrespro.com Russian Postgres Company