Re: SQL statement -- about index and group by

From: Chris Hamilton <toneczar_at_erols.com>
Date: 1998/04/20
Message-ID: <01bd6c51$68414260$73344b9b_at_chrish.hq.usace.army.mil>#1/1


[Quoted] °½Ãi¿ß <Grafield_at_grafield.com.tw> wrote ...

> When I issue an Select statement with group by ,
> is it useful to create a index on the columns in group by function ?
>
> example :
>
> There is a lot of data in Table Table_AA, I use
>
> SELECT COUNT(*), C_1, C_2, C_3, C_4, C_5
> FROM TABLE_AA
> GROUP BY C_1, C_2, C_3, C_4, C_5
>
> For the performance, do I need to create a index on (C_1, C_2, C_3, C_4,
> C_5 )

[Quoted] [Quoted] I don't think an index would be beneficial for THIS statement. Since you're not restricting the range of values returned, a full table scan is needed, which would not use the indexes.

[Quoted] Now you need to think about other parts of your application, maybe they could benefit from indexes on the above columns. But the statement above would not.

Chris



Chris Hamilton -- christopher.h.hamilton_at_usace.army.mil US Army Corps of Engineers
http://www.serve.com/cowpb/chamilton.html Received on Mon Apr 20 1998 - 00:00:00 CEST

Original text of this message