Indexes........
-
Can anyone give me some help regarding Creation of Indexes in SQL Server. I also need to know its advantages and most importantly, its difference when compared to Primary Key Constraints.
The name is Sandeep
Hello Sandeep, Indexes are created for faster retrival of data. Its like searching a topic in a book with the help of index in book. Imagine if have to search the topic in a book without an index. It will be slower as you have to browse through each an every page to check for the topic. Indexes are of two types 1) Clustered index 2) Non clustered index. For more information about these two type index you can check books online of sql server Everytime you create a primary key using enterprise manager, it by default creates a clustered index. But thats not mandatory. You can have a primary key without any index. Its because its recommened to have a clustered index on a unique column. I hope I answered your question. please let me know incase of any query.
Rahul Goel Microsoft Cerfied Solution Developer .Net Contact me at : rahul.g2510@gmail.com
-
Hello Sandeep, Indexes are created for faster retrival of data. Its like searching a topic in a book with the help of index in book. Imagine if have to search the topic in a book without an index. It will be slower as you have to browse through each an every page to check for the topic. Indexes are of two types 1) Clustered index 2) Non clustered index. For more information about these two type index you can check books online of sql server Everytime you create a primary key using enterprise manager, it by default creates a clustered index. But thats not mandatory. You can have a primary key without any index. Its because its recommened to have a clustered index on a unique column. I hope I answered your question. please let me know incase of any query.
Rahul Goel Microsoft Cerfied Solution Developer .Net Contact me at : rahul.g2510@gmail.com
Hello Rahul, Thnx for your reply. Let me tell you what I have understood by Indexes. Please verify my points. Indexes should be only used in tables used for data retrieval and not in tables where frequent INSERT & UPDATE take place. When an Index is created over a table, then there is no need for defining a PrimaryKey for that table. Indexes are best suited for Views. Are these correct? The name is Sandeep
-
Hello Rahul, Thnx for your reply. Let me tell you what I have understood by Indexes. Please verify my points. Indexes should be only used in tables used for data retrieval and not in tables where frequent INSERT & UPDATE take place. When an Index is created over a table, then there is no need for defining a PrimaryKey for that table. Indexes are best suited for Views. Are these correct? The name is Sandeep
Xandip wrote:
Indexes should be only used in tables used for data retrieval and not in tables where frequent INSERT & UPDATE take place. When an Index is created over a table, then there is no need for defining a PrimaryKey for that table. Indexes are best suited for Views.
No. Indexes can be used in tables which perform frequent insert/update/deletes. They are used to speed up retrieval of information, so if you need to select information from these tables you should consider whether or not they should be used. A primary key is not intended to act as an index. Just because a primary key normally has an index associated with it does not mean that having an index on a table negates the need for a primary key. The PK is normally used to provide a mechanism to allow you to reference a row in another table. This is because the PK is unique, so it uniquely identifies a row. Indexes can be used in views (DB dependent), but they are not best suited for them.
Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.