EXPLAIN PLAN   «Prev  Next»

Oracle 26ai Index Access Investigation - Exercise

Objective: Investigate a full scan, measure data distribution, and decide what evidence is needed before testing an index range scan.

Scenario

A student-search request is slower than expected. The developer supplies an estimated plan containing TABLE ACCESS FULL for the query below. Assume an illustrative STUDENT table with STUDENT_NAME VARCHAR2(100) and nullable BIRTH_COUNTRY VARCHAR2(60). No suitable index on BIRTH_COUNTRY currently exists. These are teaching objects, not an installed Oracle sample schema.

SELECT student_name
FROM student
WHERE birth_country = 'USA';

A full scan is not itself proof of a problem. Do not create an index in production as part of this exercise. If you choose to execute diagnostic queries, use an authorized training database; counting rows can itself require substantial work. No Oracle SQL was executed to prepare this exercise.

Tasks

  1. Write a short investigation plan. Ask about table size, USA's share of rows, other search values, fetch behavior, relevant statistics and actual execution evidence. Explain why neither a fixed percentage nor a low distinct-value count alone decides whether an index helps.
  2. Write SQL showing the number of distinct non-null countries, the number of null country rows, and the row count for each country, including the null group. Explain how you would evaluate USA's selectivity and test a candidate index.

Self-assessment: Two tasks, 10 points total. The result page displays a model answer and rubric. Submitted prose is not automatically graded and SQL is not executed by this website.

Submit your investigation and SQL

Omit credentials and sensitive data. Keep a local copy of your answer.