Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDpUF-0006Xj-LW for pgsql-performance@arkaria.postgresql.org; Fri, 17 Jun 2016 08:50:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bDpUF-00008C-8C for pgsql-performance@arkaria.postgresql.org; Fri, 17 Jun 2016 08:50:47 +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 1bDpSY-0006Fs-Lh for pgsql-performance@postgresql.org; Fri, 17 Jun 2016 08:49:02 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bDpSU-00081B-16 for pgsql-performance@postgresql.org; Fri, 17 Jun 2016 08:49:01 +0000 Received: by mail-wm0-x22c.google.com with SMTP id v199so221174567wmv.0 for ; Fri, 17 Jun 2016 01:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=equnix-biz.20150623.gappssmtp.com; s=20150623; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc; bh=TBHUqbVQKQPdEd7KkfkONlTWxBFqHZrwa31Ixb3YSEc=; b=jkdh7eBSCQh5sBFMzAAX3Wq0ijVUYMEXFuWrUw/iHngNDO5QxGYcrYb2Sb3pxqG+af NmseKahN4zEkDBhGvB2XFqqB8I0kUpm1k1BaFWJO6nuXmQY7oiJF4nEh3aKSPsTOEqqY Gns8an3z5t1xmFpLFhxqSFkxhIJ5++RYadstNIg0gDpacgSE6AoHFoc4BlBrYQ4Bo3+5 YCML9uS4Ny87FddjVYDCLfeMzYnPX3oUBmQklHvm2xRoyYmVJOv9fA5np2r+c/YF4kgt UOxX3cggJskkhM8dc1C8+F6wE482sUnOrPNBRkrWrYvQGd1wQoSHtf3Ur0327CnZqpFQ Frzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:date:message-id:subject:from:to:cc; bh=TBHUqbVQKQPdEd7KkfkONlTWxBFqHZrwa31Ixb3YSEc=; b=ebXtbUrPK7Lr1klFFFtdvHmG+u/KYXCPd5x8LvcypVVvGwuHaJq+StFyE5veZBIUz9 pF1KNIaADUdjSoCHuE5QJ+D7HU/hXj16y7QVCzNV2Ko+3uYsP186pODdpuXQNZYpwLiY C/cZE/cyJ2nYYliQKPFD4FaDL40rbkQcDRSnnxLdYThSSd3vVMqgIUlFPU82A97ifAQb rnUB+zx84X3IvEqb/Oj1O+Mte1bMo/HNGeYcdew7HIfAmCrpcTxUZy6+TFz8mfREtm1l JwMmdz1D42eswdKQ3A6CcvLUqJpO1k/PKCbMvpCqo6nYhe7C8iPxQxRcPOZvW6V/n4Bc HUXA== X-Gm-Message-State: ALyK8tKshgjVfDqEwaBFjLQwKCDF4O5s/xMHovsG+0Owuf655GahhXBED8uj/6ggt87ZrHTOc9N7aDN9WKU2OA== MIME-Version: 1.0 X-Received: by 10.194.104.40 with SMTP id gb8mr1212292wjb.146.1466153336188; Fri, 17 Jun 2016 01:48:56 -0700 (PDT) Reply-To: julyanto@equnix.co.id Received: by 10.194.24.100 with HTTP; Fri, 17 Jun 2016 01:48:56 -0700 (PDT) X-Originating-IP: [110.138.81.35] In-Reply-To: References: Date: Fri, 17 Jun 2016 15:48:56 +0700 X-Google-Sender-Auth: XEQOVTk-g1z7N7EAlZrGNZs8E_Q Message-ID: Subject: Re: Indexes for hashes From: julyanto SUTANDANG To: Ivan Voras Cc: Claudio Freire , postgres performance list Content-Type: multipart/alternative; boundary=089e010d7d50ca48fe0535756c0b X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org --089e010d7d50ca48fe0535756c0b Content-Type: text/plain; charset=UTF-8 Crc32 is great because it is supported by Intel Hardware, unfortunatelly you have to code something like this: http://stackoverflow.com/questions/31184201/how-to-implement-crc32-taking-advantage-of-intel-specific-instructions int32_t sse42_crc32(const uint8_t *bytes, size_t len){ uint32_t hash = 0; size_t i = 0; for (i=0;i wrote: > And in any case, there's no crc32 in the built-in pgcrypto module. > > > On 17 June 2016 at 06:18, Claudio Freire wrote: > >> On Fri, Jun 17, 2016 at 1:09 AM, julyanto SUTANDANG >> wrote: >> > This way is doing faster using crc32(data) than hashtext since crc32 is >> > hardware accelerated in intel (and others perhaps) >> > this way (crc32) is no way the same as hash, much way faster than >> others... >> > >> > Regards, >> >> Sure, but I've had uniformity issues with crc32. >> > > -- Julyanto SUTANDANG Equnix Business Solutions, PT (An Open Source an Open Mind Company) Pusat Niaga ITC Roxy Mas Blok C2/42. Jl. KH Hasyim Ashari 125, Jakarta Pusat T: +6221 22866662 F: +62216315281 M: +628164858028 Caution: The information enclosed in this email (and any attachments) may be legally privileged and/or confidential and is intended only for the use of the addressee(s). No addressee should forward, print, copy, or otherwise reproduce this message in any manner that would allow it to be viewed by any individual not originally listed as a recipient. If the reader of this message is not the intended recipient, you are hereby notified that any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is strictly prohibited. If you have received this communication in error, please immediately notify the sender and delete this message.Unless it is made by the authorized person, any views expressed in this message are those of the individual sender and may not necessarily reflect the views of PT Equnix Business Solutions. --089e010d7d50ca48fe0535756c0b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Crc32 is great because it is supported by Intel Hardware, = unfortunatelly you have to code something like this:



int32_t sse42_crc32(const uint8_t <=
/span>*bytes, =
size_t len)
{
  uint32_t hash =3D=
 0;
  size_t i =3D 0;
  for (i=
=3D0;i<len;i++) =
{
    hash =3D _mm_crc32_u8(hash, bytes[i=
]);
  }

  return hash;
}
It is su= pported by GCC and will implemented as hardware computing which really fast= .
you can use 64bit integer to have more pr= ecise hashing, so don't worry about uniformity.

Btw: crc32 is no= t part of the cryptography, it is part of hashing or signature.

Regards, =C2=A0


On Fri, Jun 17, 2016 at 3:32 PM, Ivan Voras <ivoras= @gmail.com> wrote:
And i= n any case, there's no crc32 in the built-in pgcrypto module.

<= /div>
On 17 June 2016 at 06:18, Claudio Freire <klaussfreire@gmail.com> wrote:
On = Fri, Jun 17, 2016 at 1:09 AM, julyanto SUTANDANG
<julyanto@equ= nix.co.id> wrote:
> This way is doing faster using crc32(data) than hashtext since crc32 i= s
> hardware accelerated in intel (and others perhaps)
> this way (crc32)=C2=A0 is no way the same as hash, much way faster tha= n others...
>
> Regards,

Sure, but I've had uniformity issues with crc32.




--
=


Julyanto SUTANDANG

Equnix Business Solutions, = PT
(An Open Source an Open Mind Company)

Pusat Niaga ITC Roxy Mas= Blok C2/42.=C2=A0 Jl. KH Hasyim Ashari 125, Jakarta Pusat
T: +6221 2286= 6662 F: +62216315281 M: +628164858028


Caution: The information e= nclosed in this email (and any attachments) may be legally privileged and/o= r confidential and is intended only for the use of the addressee(s). No add= ressee should forward, print, copy, or otherwise reproduce this message in = any manner that would allow it to be viewed by any individual not originall= y listed as a recipient. If the reader of this message is not the intended = recipient, you are hereby notified that any unauthorized disclosure, dissem= ination, distribution, copying or the taking of any action in reliance on t= he information herein is strictly prohibited. If you have received this com= munication in error, please immediately notify the sender and delete this m= essage.Unless it is made by the authorized person, any views expressed in t= his message are those of the individual sender and may not necessarily refl= ect the views of PT Equnix Business Solutions.
--089e010d7d50ca48fe0535756c0b--