Re: Unique rows without a key

From: "Thalis A(dot) Kalfigopoulos" <thalis(at)cs(dot)pitt(dot)edu>
To: Doug McNaught <doug(at)wireboard(dot)com>
Cc: Steve Micallef <stevenm(at)ot(dot)com(dot)au>, pgsql-general(at)postgresql(dot)org
Subject: Re: Unique rows without a key
Date: 2001-06-14 15:14:05
Message-ID: Pine.LNX.4.21.0106141110430.19889-100000@aluminum.cs.pitt.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 14 Jun 2001, Doug McNaught wrote:

> "Thalis A. Kalfigopoulos" <thalis(at)cs(dot)pitt(dot)edu> writes:
>
> > > Thanks for your help. However I was thinking more along the lines of using
> > > the table itself as the index. Creating a hash column with all the other
> > > columns as part of it still significantly increases my table size.
> >
> > It's not that much of an overhead especially if your table has many
> > attributes. There is a function hashname() that will return an
> > integer after hashing the text it takes as argument. I didn't find
> > any documentation, but seems to work.
>
> If it's not documented I'd worry about it going away in the future.
>
> > Then you just add a unique index on hashval and you are done :-)
>
> And if you get a hash collision? Going to disallow a perfectly
> legitimate and unique row because of it?
>
> -Doug

Right on both points (especially the second one). Is it my imagination or are there plans to add md5 hashing?
Anyway, worst case scenario, one will have to write one's own md5 function and extract the hashval from there. If you get a collision there, then you should be very happy with your achievement ;-)

cheers,
thalis

> --
> The rain man gave me two cures; he said jump right in,
> The first was Texas medicine--the second was just railroad gin,
> And like a fool I mixed them, and it strangled up my mind,
> Now people just get uglier, and I got no sense of time... --Dylan
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lamar Owen 2001-06-14 15:16:14 Re: Log files, how to rotate properly
Previous Message Doug McNaught 2001-06-14 15:09:12 Re: Unique rows without a key