Which Oracle access method is the fastest way for Oracle to retrieve a single row?
-
Primary key access
-
Access via unique index
-
Table access by ROWID
-
Full table scan
ROWID provides the fastest access because it contains the exact physical address of the row in the database file (data block, row position). Primary key access and unique index access require index traversal first, then table access. Full table scan reads every row, making it the slowest method.
To answer this question, let's go through each option to understand why it is correct or incorrect:
Option A) Primary key access - This option is a fast way for Oracle to retrieve a single row. When a table has a primary key defined, Oracle can use the primary key index to directly access the specific row based on its primary key value.
Option B) Access via unique index - This option is also a fast way for Oracle to retrieve a single row. When a table has a unique index defined on a column, Oracle can use the unique index to directly access the specific row based on its unique index value.
Option C) Table access by ROWID - This option is the fastest way for Oracle to retrieve a single row. The ROWID is a unique identifier for each row in a table, and Oracle can use the ROWID to directly access the specific row without needing to use an index.
Option D) Full table scan - This option is not the fastest way for Oracle to retrieve a single row. A full table scan involves reading every row in the table, which can be time-consuming and resource-intensive. It is generally used when retrieving multiple rows or when there is no appropriate index available.
The correct answer is C) Table access by ROWID. This option is the fastest way for Oracle to retrieve a single row because it directly accesses the specific row using its unique ROWID identifier.