Nonclustered index and clustered index differences

Source: Internet
Author: User

This is what I saw in a SQL 2005 Express tutorial, introducing the nonclustered index and clustered index difference fragments, very good, so paste it:

Determining what makes a good Index
To create an index on a table and you have to specify which columns is contained within the index.
Columns in an index does not have a to all is of the same data type. You should being aware that there is a
Limit of columns on an index, and the total amount of data for the index columns within a row
Cannot is more than bytes. To is honest, if you get to a index that contains more than four or
Five columns, you should stand back and reevaluate the index definition. Sometimes you'll have
More than five columns, but you really should double-check.
It is possible to get around this restriction and has an index that does include columns that
is not part of the key:the columns is tagged onto the end of the index. This would mean that
Index takes up more space, but if it means so SSE can retrieve all of the data from an index search,
Then it'll be faster. However, to reiterate, if is going down this route for indexes, perhaps
Need to look at your design.
In the sections that follow, we'll examine some of the factors that can determine whether an
Index is good:
using "low-maintenance" columns
using primary and foreign keys
being able to find a specific record
using covering indexes
looking for a range of information
keeping the data in order
Using low-maintenance Columns
As I ' ve indicated, for nonclustered indexes the actual index data are separate from the table data,
Although both can be stored in the same area or in different areas (e.g., on different hard drives). To
Reiterate, this means if you insert a record to a table, the information from the columns
Included in the index is copied and inserted to the index area. So, if you alter the data in a column
Within a table, and that column have been defined as making up an index, SSE also have to alter the
Data in the index. Instead of only one update being completed, and both would be completed. If the table
has + than one index, and in more than one of those indexes is a column that's to be updated a
Great deal, there may is several disk writes to perform when updating just one record. While this
Would result in a performance reduction for data-modification operations, appropriate indexing would
Balance this off by greatly increasing the performance of data-retrieval operations.
Therefore, data that was low maintenance-namely, columns that was not heavily updated-
Could become an index and would make a good index. The fewer disk writes that SSE have to do, the
Faster the database would be, as well as every and other database within that SSE instance. Don ' t let this
Statement put you off. If you feel this data within a table is retrieved more often than it is modified,
Or if the performance of the retrieval is more critical than the performance of the modification and then
Do look at including the column within the index.
In the example application we ' re building, each month we need to update a customer's bank
Balance with any interest gained or charged. However, we have a nightly job, which wants to the check for
Clients who has between and $50,000, as the bank can get a higher rate of deposit with the
Federal Reserve on those sorts of amounts. A client ' s bank balance would be constantly updated, but
An index in this sort of column could speed up the overnight deposit check program. Before the
Index in this example are created, we need to determine whether the slight performance degradation
In the updating of the balances are justified by the improvement of performance of the deposit check
Program.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.