You are on page 1of 14

Index

Classification
Clustered vs. unclustered:
 If order of data records is
the same as order of index
data entries, then called
clustered index.
Index
Classification
A file can be clustered on at
most one search key.
Cost of retrieving data records
through index varies greatly
based on whether index is
clustered or not!
Clustered vs.
Unclustered Index
CLUSTERED UNCLUSTERED

Index entries
direct search for
data entries

Data Data
entries (Index File) entries
(Data file)

Data Records Data Records


When to Use Indexes

Useful on large tables


Required on PK
Useful for attributes
appearing in where, order
by and group by clauses
When to use
Significant variety in values
Check the limit of indexes
with your DBMS
Make your decision very
much justifiable; indexes
introduce overhead
Indexes Summary
Useful tool to speedup the data
access
Can be unique or non-unique
Can be implemented through
different techniques
Be careful; they involve
overhead
Views
Definition
A view is defined to combine
certain data from one or more
tables for different reasons
A view is like a window through
which we can see data from one
or more tables
Why Views?
Security
 Show the data to a users’ group that
is necessary/required for them
 Give only necessary authorizations
 No concern with rest of the data
Why Views?
Efficiency
 Part of a query that is frequently used (a
subquery), define it as a view
 The view definition will be stored and
will be executed anytime anywhere view
is referred
Why Views?
Join columns from multiple tables
so that they look like a single table
Aggregate information instead of
supplying details
Characteristics of Views
Not exactly the external views of
3-level schema architecture
Major Types
 Dynamic
 Materialized
 Partitioned
 Simple/complex
Dynamic Views
Data is not stored for the views
Definition is stored in the
schema
Executed every time view is
referred
Defining Dynamic
Views
CREATE VIEW [ < database_name
> . ] [ < owner > . ] view_name
[ ( column [ ,...n ] ) ]
[ WITH ENCRYPTION |
SCHEMABINDING [ ,...n ] ]
AS
select_statement
[ WITH CHECK OPTION ]

You might also like