Re: indexes - Mailing list pgsql-general

From Richard Huxton
Subject Re: indexes
Date
Msg-id 200303271245.28067.dev@archonet.com
Whole thread Raw
In response to Re: indexes  (Dennis Gearon <gearond@cvc.net>)
List pgsql-general
On Wednesday 26 Mar 2003 10:57 pm, Dennis Gearon wrote:
> The right hand little finger on the carriager return is quicker than my
> brain. I will now FINISH my question :-)
>
> ----------------------------------------------------
> Would a unique index, or a trigger doing a:
>
> IF ( SELECT COUNT(*) where _index_condition_ ) THEN
>      CRY MOMMA and GO HOME.
>
> be faster?

SELECT COUNT(*) will always do a sequential scan (at the moment and for the
immediate future versions AFAIK). Unless the table is small, a unique index
seems the best.

--
  Richard Huxton


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: before/after triggers
Next
From: Bruno Wolff III
Date:
Subject: Re: Earth distance