
How to Create Composite Indexes in Oracle
Index several columns together, enforce unique combinations such as one ticket per seat, and order the columns the way queries filter.

Index several columns together, enforce unique combinations such as one ticket per seat, and order the columns the way queries filter.

Speed up existing reports without changing them: let the optimizer answer queries from materialized views through query rewrite.

Keep materialized views always current by applying only the changes with materialized view logs and REFRESH FAST ON COMMIT.

Bring stale materialized views up to date with DBMS_MVIEW.REFRESH, completely or fast, one at a time or several as a consistent set.

Store the results of expensive queries in materialized views, choose how they are built and refreshed, and let other queries use them.

Stop inserts and updates through a view from producing rows the view cannot see, make views read-only, and update through join views.

Divide ordered rows into quartiles, deciles, or any number of equal-sized buckets with NTILE, and describe the range of each bucket.

Find what fraction of each group falls at or below every row with CUME_DIST, and select the top or bottom percent of the rows.

Express each row's position as a fraction from 0 to 1 within its group, and compare relative standing across groups of any size.

Rank rows without gaps after ties with DENSE_RANK, and use it to find the second- or Nth-highest distinct value in each group.

Rank rows like places in a competition, where ties share a place and the next place skips, overall or within each group.

Keep provably unaltered records with insert-only blockchain tables, whose rows are chained by cryptographic hashes in hidden columns.

Protect audit and compliance data with insert-only immutable tables that refuse updates and delay deletes and drops by retention periods.

Split, truncate, drop, merge, and exchange single partitions of large tables, and address them by name or with PARTITION FOR.

Divide tables by region or type with list partitioning, spread rows evenly with hash partitioning, and handle values that fit no list.

Store each month of a large table in its own partition with range and interval partitioning, and read only the partitions a query needs.

Store rows inside the primary key index with ORGANIZATION INDEX for fast key lookups and range scans, and know when an IOT fits.

Query CSV and other files on the database server as tables without loading them, with an external table or an inline EXTERNAL clause.