Questions about indexes

  • Hi,

    I have few questions about indexes.

    For example : I have one table with some user data, primary key is on field userID and I do not have any other indexes there.

    Often I am running some stored procedures where I have something like :

    select count(username) from members where username=@to

    Will it help if I create one index on username (varchar type) ?

    This is just one example, but I have a lot of selects where I use not primary key

    fields in condition but I am not sure will it make performaces better if I create

    indexes on all or most of my fields in "where" parts.

    Thanks,

    Oliver

    Edited by - LDL on 07/22/2003 4:25:59 PM

  • Hi Oliver,

    quote:


    I have few questions about indexes.

    For example : I have one table with some user data, primary key is on field userID and I do not have any other indexes there.

    Often I am running some stored procedures where I have something like :

    select count(username) from members where username=@to

    Will it help if I create one index on username (varchar type) ?

    This is just one example, but I have a lot of selects where I use not primary key

    fields in condition but I am not sure will it make performaces better if I create

    indexes on all or most of my fields in "where" parts.


    why not utilize the Index tuning wizard in QA and see what he suggests?

    Also, there are many thread on indexes around. The one I got kicked between the legs is this one

    http://www.sqlservercentral.com/forum/link.asp?TOPIC_ID=13498

    HTH

    Cheers,

    Frank

    Hey, Du hast eine deutsche Mailadresse! Hurra, jetzt sind wir schon zwei!

    Edited by - a5xo3z1 on 07/23/2003 01:16:04 AM

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply