Re: Need help requiring uniqueness in text columns

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Matthew Wilson" <matt(at)tplus1(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Need help requiring uniqueness in text columns
Date: 2008-01-02 15:23:08
Message-ID: 162867790801020723q13b81da0h1d5663a97347cf45@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/01/2008, Matthew Wilson <matt(at)tplus1(dot)com> wrote:
> On Wed 02 Jan 2008 04:23:46 AM EST, Pavel Stehule wrote:
> > Hello
> >
> > IDEA 3:
> >
> > Use two hash functions:
> >
> > CREATE UNIQUE INDEX uidx ON TEST((decode(md5(a),'hex')),(hashtext(a)));
> >
> > removing spaces helps
> > CREATE UNIQUE INDEX uidx ON test((decode(md5(lower(replace(a,' ',''))),'hex')));
> >
> > Regards
> > Pavel Stehule
> >
> > CREATE UNIQUE INDEX nodups on MESSAGE (my_timestamp_col, md5(my_text_col));
>
> What is the advantage of this method?
>

much less unique index.

Regards
Pavel

> --
> Programming, economics, gardening, life in Cleveland.
> http://blog.tplus1.com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org/
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2008-01-02 15:25:37 Re: Creating XML/KML documents from single tables
Previous Message Matthew Wilson 2008-01-02 15:11:09 Re: Need help requiring uniqueness in text columns