Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id B69651337B82 for ; Thu, 10 Feb 2011 22:27:42 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 32981-06 for ; Fri, 11 Feb 2011 02:27:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mail.postgresql.org (Postfix) with ESMTP id 0EC511337B5C for ; Thu, 10 Feb 2011 22:27:35 -0400 (AST) Received: from [192.168.1.6] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MNvyt-1PmJom2B8F-007Beq; Fri, 11 Feb 2011 03:27:32 +0100 Message-ID: <4D549E92.4010709@2ndquadrant.com> Date: Thu, 10 Feb 2011 21:27:30 -0500 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Stephen Frost CC: Euler Taveira de Oliveira , Pgsql Hackers Subject: Re: [PERFORM] pgbench to the MAXINT References: <4D27C4E5.5000609@2ndquadrant.com> <4D2A965A.3000603@timbira.com> <4D2AC273.3010709@2ndquadrant.com> <4D2CCCD9.802@timbira.com> <4D35DF33.6060901@2ndquadrant.com> <4D5017DE.90404@2ndquadrant.com> <4D525281.1000201@2ndquadrant.com> <20110209194008.GX4116@tamriel.snowman.net> In-Reply-To: <20110209194008.GX4116@tamriel.snowman.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:odO9pOausFxWwwOuTsnF/0cG1Evevfy2lIJBhsrDHn4 eayl49CDPepD5OohAmq6NwAc7vv2+z3FIUnEkqCUEh1/IjfCp4 XYYJx2LgC3YI7V2KLaCOHArkLzxKJASZZBIHBu4lytpGGR1V2T g64oiZLfthiIL9vGpCt5IAVKqzwBVpHYWm8yBmh8+zutxux8TK pySx7vpEzI2eGcw1HV4TC2SRSe/iQ9PEqQr5FgWuuY= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201102/916 X-Sequence-Number: 181705 Stephen Frost wrote: > Just wondering, did you consider just calling random() twice and > smashing the result together..? > I did. The problem is that even within the 32 bits that random() returns, it's not uniformly distributed. Combining two of them isn't really going to solve the distribution problem, just move it around. Some number of lower-order bits are less random than the others, and which they are is implementation dependent. Poking around a bit more, I just discovered another possible approach is to use erand48 instead of rand in pgbench, which is either provided by the OS or emulated in src/port/erand48.c That's way more resolution than needed here, given that 2^48 pgbench accounts would be a scale of 2.8M, which makes for a database of about 42 petabytes. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books