Enterprise Java Development@TOPIC@

Chapter 4. Indexes

4.1. Index Range Scan
4.2. Unique Index Scan
4.3. Composite Index
4.3.1. Query Parts
4.3.2. First Term Indexed
4.3.3. First and Second Term Indexed (using Composite Index)
4.4. Index Fast Full Scan (with Composite Index)
4.4.1. Query Parts
4.4.2. Option: Use Range Scan and RowId Access
4.4.3. Option: Use Range Scan Alone with Composite Index
4.4.4. Option: Fast Full Scan
4.5. Summary

Request N rows matching a specific criteria using a non-unique index


* "utitle" was added as the concatenation of title(id) to create a unique column.

** we are not yet taking advantage of the uniqueness of the column




  • Matching row located using index

  • Since index is non-unique multiple entries must be scanned


Request N rows matching a specific criteria using a unique index


* we are now taking advantage of the unique column values.




  • Index used to locate table rowId

  • Unique index scan used since index contains unique values


* the measurements in this test do not prove the following assertion which was based on the execution plan.

Unique Indexes *can* be more Efficient than Non-Unique Indexes

DB knows there can be only a single match and stops index scan after first match found

Indexes with multiple columns to match the where clause and optionally the select and join clauses as well.

Incorporate terms from select clause into composite index to bypass table access.