Your SlideShare is downloading. ×
0
Indexes
Indexes
Indexes
Indexes
Indexes
Indexes
Indexes
Indexes
Indexes
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
623
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
41
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. CIS282
  • 2. Indexes  Help to select and find records  Serve as a “cross-reference”  Can be based on one or more fields
  • 3. Types of Indexes  Clustered: How table is physically ordered  Only one per table  Non-Clustered: Index is maintained separately from table (data)  Can be stored in a separate file group to speed access (find pointers using one drive, find records on a second drive)
  • 4. Index Organization  Data in SQL Server is organized by ‘pages’  When an index entry is inserted in a full page the data is split between two pages  By default each page is filled to allow two additions
  • 5. Fill Factor  Allows you to specify how much ‘room’ to leave open on each page  Specify the percentage of each page that is used initially to store data  Impacts how often page splits occur  OLTP should have low percentage  OLAP should have high percentage
  • 6. “Good Index” Characteristics  Low maintenance columns  Values don’t change frequently  Includes columns used frequently in Where clause  Don’t have to go out to table for data  Covered indexes include multiple columns where related data is commonly used  Help search for ranges of records
  • 7. “Poor Index” Characteristics  Columns not used in queries (where clause)  Index doesn’t return one or few rows (selectivity)  Exception: indexing foreign keys can speed up joins significantly  Many columns in index  Few records in table
  • 8. Unique Constraint v. Unique Index  No significant differences between creating a unique constraint and a unique index  Data validation occurs in the same manner  Query optimizer does not differentiate between a unique index created by a constraint or created manually
  • 9. Unique Constraint or Unique Index?  A unique index makes sense when uniqueness is a characteristic of the data  Know that will always have a different value  If uniqueness must be enforced to ensure data integrity, create a unique constraint  Need to ensure that have a different value  Unique constraint allows null  Null treated as a value so can only occur once

×