Re: unique constraint on 2 columns

From: Jonathan Vanasco <postgres(at)2xlp(dot)com>
To: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: unique constraint on 2 columns
Date: 2007-04-20 22:32:50
Message-ID: 8ED586E3-27B2-4257-9860-D27D809D7CFD@2xlp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Apr 20, 2007, at 6:13 PM, Jeff Davis wrote:

> This is more correct structure, and yes, it would involve a join.

I know thats the 'more correct' way -- but I can't do the join ,
which is why I posted about a 2 column unique index.
I tested with a join before posting - i have an already large table
that is growing quickly. in order to use the join and keep current
performance I'd need to scale out in hardware - which is just not an
option right now. searching 100M records vs searching 100M records +
a join is a huge difference. when you try to do analytics, its just
not appropriate in my situation.

> No, it does not mean you need to rewrite anything. Use a view; that's
> the great benefit you get from using a relational database like
> PostgreSQL.

i'd have to rewrite everything that reads from that table to use the
view instead of the current query, and then worry about inserts.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2007-04-20 23:10:38 Re: unique constraint on 2 columns
Previous Message Jeff Davis 2007-04-20 22:13:33 Re: unique constraint on 2 columns