Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,

Could u plz tell me how to create clustered index and non-clustered index in query. How to remove that after creating.



Thanks in Advance
Posted
Comments
Corporal Agarn 10-Aug-11 10:38am    
By "query" do you mean T-SQL?

You wouldn't really create indexes as queries are run. This would have massive performance issues, particular if your table is large.

(an exception to this might be on #temp tables you've created in stored proceudre)

Your tables should be tuned with indexes so that queries will run effeciently against them.

As a general rule, every table should have a clustered index (http://www.sql-server-performance.com/2007/clustered-indexes/[^])

They should then have as many indexes as required so that queries run well, but record additions\deletions aren't adversely affected

Read up on SQL query tuning.
 
Share this answer
 
Take a look there[^] to know about Clustered and No-clustered design guidelines and its structure.
To remove index you can use DROP INDEX[^]
The DROP INDEX statement does not apply to indexes created by defining PRIMARY KEY or UNIQUE constraints. To remove the constraint and corresponding index, use ALTER TABLE with the DROP CONSTRAINT clause.
so Its better to read some guidelines for Disabling Index. take a look there-[Guidelines for Disabling Indexes and Constraints][^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900