Search Postgresql Archives

Re: Hash Function: MD5 or other?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 14, 2005 at 15:54:50 -0500,
  Peter Fein <pfein@xxxxxxxxx> wrote:
> 
> I'm unclear why I'd need to store the hash in a column. I suppose I
> could have the hash column populated by a trigger on inserts, but this
> seems to get me the same functionality & is less obvious.
> 
> For the archives, I did:
> 
> CREATE UNIQUE INDEX idx_md5_sometext  ON mytable USING btree
>   (group_id, md5(sometext))
>   WHERE group_representative = true;
> 
> I then basically replicate this in a SELECT on the client side
> (including calculating the MD5 by the client) to figure out the correct
> value for group_representative before inserting a new row. This is the
> only way I use the MD5, so I don't much care about retrieving it in
> other contexts.

That should work fine.

I wasn't sure that you weren't going to want to use the hash for joins.
And I was a little concerned that because you used the phrase "hash index",
that you might be considering using a hash (as opposed to btree) index.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux