Co-Clustering Indices

Two indices are co-clustered if the data pages for the indices are in common

  • Records encoding tuples in the indices are interleaved within the same data pages
  • Useful when (1,N) relationships exist between the records for the two indices

Can speed up joins
Sequential scans of either relation become slower

Ordered indices allow more general subqueries to be evaluated efficiently

Range Queries

Btrees can help evaluating a query with the form

select * from <table>
where <attribute> >= <constant>
Multi-attribute Search Keys

It is usually possible to create an index on several attributes of the same relation

Assume relation name PROM/(pnum, lname, fname, dept)
→ Secondary index now defined as follows

create view PROF-SECONDARY
as (select lname, fname, rid from PROF-PRIMARY)
materialized as BTREE with search key (lname, fname)

Order in which attributes appear in the search key is important

Multi-Attribute Indices

PROF-SECONDARY index is useful for the following queries

select * from PROF where lname = 'Smith'
select * from PROF and lname = 'Smith' and fname = 'John'

Very useful for these queries

-- Number of data pages storing secondary index can be less
select fname from PROF where lname = 'Smith'
-- No need to go to primary index
select fname, lname from PROF

Unlikely to be useful for

select * from PROF where fname = 'John'
-- Need primary index