Understanding Indexes in Database Systems

database systems lecture 6 indexes n.w
1 / 16
Embed
Share

Explore the world of database systems and indexes, including balanced B-trees, clustered indexes, covering indexes, index selection, and maintenance tips. Learn about creating unique, clustered, and nonclustered indexes, as well as disabling and maintaining indexes to optimize database performance.

  • Database Systems
  • Indexes
  • Clustered Index
  • B-tree
  • Covering Index

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Database systems Lecture 6 Indexes Roman Danel 2016

  2. Indexes Balanced B-tree Root node Zero or more intermediate levels Leaf level entries in sorted order that corresponed to data

  3. B-tree

  4. Clustered Index Column for clustered index clustering key SQL server order the data in the table according clustering key The leaf level of CU is data in the table CU does not always be on primary key

  5. CREATE UNIQUE/CLUSTERED/NONCLUSTERED INDEX index_name ON object_name column_name ASC/DESC [with OPTION ] [ON partition_scheme (col_name)]

  6. Notes Primary Key and Unique constraints are implemented as unique index Object table or view Nonclustering 249 on single table; B-tree structure the leaf level contains pointer to data

  7. Covering Index An index that can satisfy the query without having to access the table

  8. Index selection Server determines whether to use an index by examining only the first column defined in the index! Example: index defined on FirstName, LastName and query looking for LastName -> this index will not be used

  9. Option PAD_INDEX on/off FILLFACTOR 0-100% - how full leaf level SORT_IN_TEMPDB default is off IGNORE_DUP_KEY STATISTICS_NORECOMPUTE DROP EXISTING ONLINE ALLOW_ROW_LOCKS ALLOW_PAGE_LOCKS MAXDOP maximum degree of parallelism, max. 64

  10. Disabling Index ALTER INDEX index_name ON object_name DISABLE

  11. Maintenance Do you really need more then 5 indexes on one table? If the leaf level index page does not have room for new value -> page split

  12. Best practices All tables should have primary keys All tables should have clustered index Identify poorly performing queries -> create nonclustered index Identify

  13. Index Fragmentation Insert, update, delete SQL Server 2005 8 KB per index page

  14. Reorganize and Rebuild Index ALTER INDEX index_name ON object_name REBUILD Rebuild - Droping and recreating index

  15. Find FillFactor Values Sys.indexes External fragmentation physical order of index pages does not match the logical order

  16. Statistics Statistical information about the distribution of values in a column used by query optimizer to estimate the cost of using index Histogram AUTO_CREATE_STATISTICS = ON/OFF UPDATE STATISTICS or sp_autostats Sys.cats tables Sys.stat_columns row for each column from sys.cats

Related


More Related Content