Top WebProNews Articles |
Vertical Search For The Farmland
AgWebSearch.com focuses on an area most tech writers only know from seeing cornfields in the X-Files movie "Fight The Future"; it turns out the agriculture vertical needed a dedicated search service.
FEC Boosts Online Political Bloggers
Campaign finance law will cover online political advertising, but other communication like blogs and email remains uncovered by the law.
Vista 60 Percent Rewrite Is All Speculation
A report from an Australian publication citing a source at Acer Australia claimed up to 60 percent of the Windows Vista code needed to be rewritten, and Xbox engineers were being moved over to help with the programming.
For Whom The Blather Tolls
Ben Goodger, lead engineer for Firefox, embraced the Hemingway mindset in describing how busy people should approach writing.
Google Hires Creator Of Vim
Bram Moolenaar, creator of the text editor Vim, or Vi improved, will begin working with Google in the company's Zurich offices.
Google's New Look Through Javascript
ZDNet's "Googling Google" blogger Garett Rogers found a Javascript trick that unveils the occasionally glimpsed new look of Google's search results to Firefox users.
|
|
|
03.28.06
SQL Server Indexes
By
Chris Kemp
A database index is similar to an index in a book - it is comprised of a lookup value, and a number identifier that corresponds to the row number in a table.
In SQL Server, there are two kinds of indexes - clustered and non-clustered. Clustered Indexes require that the data in the table is physically sorted in the order of the index.
Because the data in a table can be physically sorted only one way, there can be at most only one clustered index per table.
Non clustered indexes do not require that data to be physically sorted, so there can be more that one non-clustered index per table.
In fact SQL Server allows up to 249 non-clustered indexes per table. Because data is not physically sorted, range searches using a non clustered index are not very efficient.
The command for creating an index in T-SQL is
CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name ON { table | view } ( column [ ASC | DESC ] [ ,...n ] ) [ WITH < index_option > [ ,...n] ] [ ON filegroup ] < index_option > :: = { PAD_INDEX | FILLFACTOR = fillfactor | IGNORE_DUP_KEY | DROP_EXISTING | STATISTICS_NORECOMPUTE | SORT_IN_TEMPDB }
PAD_INDEX specifies the percentage of space left free on the non-leaf levels of the index.
FILLFACTOR specifies the percentage to fill the leaf pages.
SORT_IN_TEMPDB specifies that intermediate results of the sort will be stored in tempdb. This increases disk space requirement but affects speed index creation.
STATISTICS_NO_RECOMPUTE tells the system not to automatically update index statistics.
Of course, indexes can also be created and managed using the Enterprise Manager. They can be created using the Create Index Wizard, from the Database Diagram, or by modifying fields in the Table Designer.
There is a trade off with indexes. While they speed up execution of queries immensely, there is overhead associated with them. They consume additional disk space, and require additional time to update themselves whenever data is updated or appended to a table.
When loading large amounts of data it may pay to drop the index prior to the loading, then recreate the index after the new records have been appended to the table. Indexes can be dropped using the Table Designed, or by using the DROP INDEX command.
Indexes can also become fragmented. To defrag an index, either drop and recreate the index, or issue the command dbcc indexdefrag.
About the Author:
Chris Kemp is a well known author in the field of IT Consulting
in New York, New Jersey USA. |