Re: Questions about indexes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ryan Bradetich <rbradetich(at)uswest(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Questions about indexes?
Date: 2003-02-17 06:34:50
Message-ID: 2336.1045463690@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ryan Bradetich <rbradetich(at)uswest(dot)net> writes:
> Although the table schema is immaterial, I will provide it so we have a
> common framework for this discussion:

> host_id integer (not null)
> timestamp datetime (not null)
> category text (not null) [<= 5 chars]
> anomaly text (not null) [<= 1024 chars]

> This table is used to store archived data, so each row in the table must
> be unique. Currently I am using a primary key across each column to
> enforce this uniqueness.

It's not real clear to me why you bother enforcing a constraint that the
complete row be unique. Wouldn't a useful constraint be that the first
three columns be unique? Even if that's not correct, what's wrong with
tolerating a few duplicates? You can't tell me it's to save on storage
;-)

> I am not sure why all the data is duplicated in the index ... but i bet
> it has to do with performance since it would save a lookup in the main
> table.

An index that can't prevent looking into the main table wouldn't be
worth anything AFAICS ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryan Bradetich 2003-02-17 07:05:31 Re: Questions about indexes?
Previous Message Ryan Bradetich 2003-02-17 06:12:28 Questions about indexes?