Thread: indexes

indexes

From
Dennis Gearon
Date:
Would a unique index, or a trigger doing a:

IF ( SELECT COUNT(*) where _index_condition_ ) THEN
    CRY MOMMA and GO HOME.


Re: indexes

From
Dennis Gearon
Date:
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?


Re: indexes

From
Richard Huxton
Date:
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