1. Trang chủ
  2. » Công Nghệ Thông Tin

Indexes trungtt dhbkhn

14 700 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 14
Dung lượng 1,38 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Jennifer Widom Indexes Jennifer Widom Indexes Indexes  Primary mechanism to get improved performance on a database  Persistent data structure, stored in database  Many interesting implementation issues But we are focusing on userapplication perspective Jennifer Widom Indexes Functionality A B C 1 cat 2 … 2 dog 5 … 3 cow 1 … 4 dog 9 … 5 cat 2 … 6 cat 8 … 7 cow 6 … … … … Index on T.A T Jennifer Widom Index on T.A Indexes Functionality A B C 1 cat 2 … 2 dog 5 … 3 cow 1 … 4 dog 9 … 5 cat 2 … 6 cat 8 … 7 cow 6 … … … … Index on T.B T Jennifer Widom Index on T.A Indexes Functionality A B C 1 cat 2 … 2 dog 5 … 3 cow 1 … 4 dog 9 … 5 cat 2 … 6 cat 8 … 7 cow 6 … … … … Index on T.B Index on T.(A,B) T Jennifer Widom Indexes Utility  Index = difference between full table scans and immediate location of tuples  Orders of magnitude performance difference  Underlying data structures – Balanced trees (B trees, B+ trees) – Hash tables Jennifer Widom Select sName From Student Where sID = 18942 Many DBMS’s build indexes automatically on PRIMARY KEY (and sometimes UNIQUE) attributes Indexes Jennifer Widom Select sID From Student Where sName = ‘Mary’ And GPA > 3.9 Indexes Jennifer Widom Select sName, cName From Student, Apply Where Student.sID = Apply.sID Indexes Jennifer Widom Indexes Downsides of Indexes 1) 2) 3) Jennifer Widom Indexes Picking which indexes to create Benefit of an index depends on:  Size of table (and possibly layout)  Data distributions  Query vs. update load Jennifer Widom Indexes “Physical design advisors” Input: database (statistics) and workload Output: recommended indexes Query Optimizer Database statistics Query or update Indexes Best execution plan with estimated cost Jennifer Widom Indexes SQL Syntax Create Index IndexName on T(A) Create Index IndexName on T(A1,A2,…,An) Create Unique Index IndexName on T(A) Drop Index IndexName Jennifer Widom Indexes Indexes  Primary mechanism to get improved performance on a database  Persistent data structure, stored in database  Many interesting implementation issues But we are focusing on userapplication perspective

Trang 1

Indexes

Trang 2

Indexes

Indexes

 Primary mechanism to get improved performance

on a database

 Persistent data structure, stored in database

 Many interesting implementation issues

But we are focusing on user/application perspective

Trang 3

Indexes

Functionality

A B C

1 cat 2

2 dog 5

3 cow 1

4 dog 9

5 cat 2

6 cat 8

7 cow 6

Index

on T.A

T

Trang 4

Index

on T.A

Indexes

Functionality

A B C

1 cat 2

2 dog 5

3 cow 1

4 dog 9

5 cat 2

6 cat 8

7 cow 6

Index

on T.B

T

Trang 5

Index

on T.A

Indexes

Functionality

A B C

1 cat 2

2 dog 5

3 cow 1

4 dog 9

5 cat 2

6 cat 8

7 cow 6

Index

on T.B

Index

on T.(A,B)

T

Trang 6

Indexes

Utility

 Index = difference between full table scans and

immediate location of tuples

 Orders of magnitude performance difference

 Underlying data structures

– Balanced trees (B trees, B+ trees)

– Hash tables

Trang 7

Select sName

Many DBMS’s build indexes automatically on

PRIMARY KEY (and sometimes UNIQUE) attributes

Indexes

Trang 8

Select sID

Where sName = ‘Mary’ And GPA > 3.9

Indexes

Trang 9

Select sName, cName

Indexes

Trang 10

Indexes

Downsides of Indexes

1)

2)

3)

Trang 11

Indexes

Picking which indexes to create

Benefit of an index depends on:

 Size of table (and possibly layout)

 Data distributions

 Query vs update load

Trang 12

Indexes

“Physical design advisors”

Input: database (statistics) and workload

Output: recommended indexes

Query Optimizer

Database statistics Query or update

Indexes

Best execution plan with estimated cost

Trang 13

Indexes

SQL Syntax

Trang 14

Indexes

Indexes

 Primary mechanism to get improved performance

on a database

 Persistent data structure, stored in database

 Many interesting implementation issues

But we are focusing on user/application perspective

Ngày đăng: 24/05/2016, 15:19

TỪ KHÓA LIÊN QUAN

w