Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Suggest me for indexing

Author  Topic 

mrleokarthik
Starting Member

16 Posts

Posted - 2007-11-23 : 00:27:18
As we all know that most of our database application have table for login information. I want to know is Username and password fields requires indexing for fast accesing?

Does indexing required for fields that participates in where clause of a query

suresha_b
Yak Posting Veteran

82 Posts

Posted - 2007-11-23 : 01:01:02
How many users are there?
How many rows are there in this table?
If the table is very small, index will not make much difference.
if update/delete are more than select, the index makes it slower.

Generally speakig, yes, indexing required for fields that participates in where clause of a query.

Suresh B.
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-11-23 : 12:13:14
Note that in this case, although you probably have both the username and the password in the WHERE clause, you only need to index on the username, not the password because username is already unique, so adding the password will only increase the size of the index, it will not make the index any more selective for the queries though.

So you don't need to index all the columns that are in the WHERE clause, just the ones that get you to the data you want most selectively. For example, you will probably use a column like Gender in a WHERE clause but indexing it would not be very selective and therefore indexing on Gender would probably not be useful.
Go to Top of Page

mrleokarthik
Starting Member

16 Posts

Posted - 2007-11-25 : 05:47:35
Thanks everybody.
Go to Top of Page
   

- Advertisement -