Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZ0FR-0004gx-AA for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jan 2018 20:11:49 +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 1eZ0FQ-00086D-4Z for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jan 2018 20:11:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eZ0FP-00085y-RG for pgsql-hackers@lists.postgresql.org; Tue, 09 Jan 2018 20:11:47 +0000 Received: from smtp-3.ensmp.fr ([194.214.158.139] helo=cascavel.ensmp.fr) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eZ0FM-0005ug-0S for pgsql-hackers@postgresql.org; Tue, 09 Jan 2018 20:11:46 +0000 Received: from cri.ensmp.fr (234.237.219.88.rev.sfr.net [88.219.237.234]) (authenticated bits=0) by cascavel.ensmp.fr (8.15.2/8.15.2/JMMC-22/Oct/2013) with ESMTPSA id w09KBRkX005069 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 9 Jan 2018 21:11:34 +0100 Date: Tue, 9 Jan 2018 21:11:26 +0100 (CET) From: Fabien COELHO X-X-Sender: fabien@sto To: Ildar Musin cc: pgsql-hackers Subject: Re: General purpose hashing func in pgbench In-Reply-To: <9603bac9-ae5d-36c5-5978-a88bdb700e37@postgrespro.ru> Message-ID: 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> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Miltered: at cascavel.ensmp.fr with ID 5A5521EF.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID coelho X-j-chkmail-Enveloppe: 5A5521EF.000 from 234.237.219.88.rev.sfr.net/234.237.219.88.rev.sfr.net/88.219.237.234/cri.ensmp.fr/ List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Ildar, > Sorry for a long delay. I've added hash() function which is just an > alias for murmur2. I've also utilized variable arguments feature from > least()/greates() functions to make optional seed parameter, but I > consider this as a hack. Patch needs a rebase after Teodor push for a set of pgbench functions. > Should we probably add some infrastructure for optional arguments? You can look at the handling of "CASE" which may or may not have an "ELSE" clause. I'd suggest you use a new negative argument with the special meaning for hash, and create the seed value when missing when building the function, so as to simplify the executor code. Instead of 0, I'd consider providing a random default so that the hashing behavior is not the same from one run to the next. What do you think? Like the previous version, murmur2 with seed looks much more random than fnv with seed... -- Fabien.