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)
 indexing to find record quicker

Author  Topic 

desikankannan
Posting Yak Master

152 Posts

Posted - 2010-02-13 : 13:40:03
i have 10000 records in a table, i wants to find particular record
based on primarykey, in this scenario , we can use indexing

what is the use of indexing?

Desikankannan

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-13 : 13:43:14
indexing helps searches to become faster. Its like adding index to a book so that you can search through index to find out which page contains your required information and then search within it rather than searching through all the pages.

More details below
http://www.simple-talk.com/sql/learn-sql-server/sql-server-index-basics/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

desikankannan
Posting Yak Master

152 Posts

Posted - 2010-02-13 : 13:59:00
hi,

how to create clustred index in a table ,i have grn table where
grn code is a primary key and i have 80000 record in that table, i wants to get grncode (25000) from the table
in this scenario how to use index,
i can use clustered index or non clustered index

Desikankannan
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-14 : 03:03:23
"i wants to find particular record based on primarykey"

If you have a Primary Key then you already have an index. Is the Primary key using Clustered or Non-Clustered?

You could change the table so that the PK uses a clustered index (i.e. if something else is already using a clustered index), but you would be changing the design of the system and you should have a very good reason for doing that.

I very much doubt that the PK was created using a non-clustered index (i.e. there is NO clustered index on the table) - you have to go miles out of your way to create that scenario!

So ... if you have a PK already and you want to retrieve a specific value it will be "instant" - whether it has Clustered or Non-clustered index.

If you have performance problems retrieving a specific row by PK value then your problem is elsewhere - such as poor housekeeping maintenance.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-02-14 : 10:44:54
Attempt to do some analysis on the types of queries that will be executed against your data. This will assist in creating an index strategy

Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-02-14 : 11:15:31
This series (3 parts) may be worth reading. http://www.sqlservercentral.com/articles/Indexing/68439/

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -