1. Index Internals
1. Index Internals
CORRECT
What typically occupies more storage space in an Oracle database: the table data or
the index entries?
A) Table data
B) Index entries
Correct Answer:A Table data Explanation: Generally, table data occupies more
storage space in an Oracle database compared to index entries. This is because the
table contains all the actual data rows and associated columns, whereas the index
contains only key columns and pointers to the corresponding rows in the table.
Incorrect Answers
B) While index entries are essential for e!cient data retrieval, they typically
occupy less storage space compared to the actual table data. Index entries
consist of keys and pointers, which are smaller in size compared to entire rows
of data.
CORRECT
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 1 of 17
:
1.
Real World Scenario: You’re working with an e-commerce database that stores product
information. A developer reports slow query performance for a search query on product
names.
Question: How can you determine which columns have indexes on them for the
products table?
CORRECT
USER_INDEXES gives information about indexes but not specific columns. (True /False)
TRUE
FALSE
CORRECT
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 2 of 17
:
Real World Scenario: You’re optimizing a reporting query that retrieves sales data from a
large table.
Question: What is the primary purpose of checking index columns for a query?
Correct Answer: B .
CORRECT
USER_IND_COLUMNS provides details about the columns included in indexes and also position
of the column in a composite Index.
True
False
CORRECT
What typically occupies more storage space in an Oracle database: the table data or
the index entries?
A) Table data
B) Index entries
Correct Answer:A Table data Explanation: Generally, table data occupies more
storage space in an Oracle database compared to index entries. This is
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 3 of 17
:
because the table contains all the actual data rows and associated columns,
whereas the index contains only key columns and pointers to the
corresponding rows in the table.
Incorrect Answers
B) While index entries are essential for e!cient data retrieval, they typically
occupy less storage space compared to the actual table data. Index entries
consist of keys and pointers, which are smaller in size compared to entire rows
of data.
CORRECT
You want to "nd more information on indexes , not sure which data dictionary to be used .
Which of the below query do you use?
Correct Answer is A. There are so many data dictionary views to get required
information on indexes, If we cannot remember , then we can use this query.
CORRECT
Which type of latest optimizer is commonly used in Oracle databases for query optimization
(used in latest versions)?
Cost based optimizer is used by latest oracle versions. "Rule based " optimizer
is used by older versions like 7.x
CORRECT
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 4 of 17
:
What is the purpose of analyzing index statistics in Oracle?
Correct Answer (B): Analyzing index statistics helps the optimizer make
informed decisions about query execution plans. Accurate statistics ensure
that the optimizer chooses the most e!cient access paths for queries.
CORRECT
True /False
During data loading or heavy operations, you can temporarily disable indexes to
improve performance. Once the data load is complete, you can rebuild the indexes
using below commands.
-- Disable the index (for data loading)
ALTER INDEX my_table_idx01 DISABLE;
-- Perform your data loading process
-- Rebuild the index
ALTER INDEX my_table_idx01 REBUILD;
Explanation:
Disabling the index makes it unusable during the data load, preventing
unnecessary maintenance overhead.
Rebuilding the index ensures it’s optimized for the newly loaded data.
FALSE
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 5 of 17
:
TRUE
TRUE
CORRECT
INCORRECT
Question: What is the di#erence between COMPUTE STATISTICS and ESTIMATE STATISTICS
options in the ANALYZE INDEX command?
A) COMPUTE STATISTICS collects detailed statistics for the index, while ESTIMATE STATISTICS
provides an estimated statistical summary based on a sample of rows or percentage of the index.
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 6 of 17
:
B) COMPUTE STATISTICS collects detailed statistics for the index, while ESTIMATE
STATISTICS provides an estimated statistical summary based on a sample of blocks or
percentage of the index.
Correct Answer (B): This is the correct answer, as the ESTIMATE STATISTICS
option uses a sample of blocks or percentage of the index to estimate the
statistics, not rows
CORRECT
INCORRECT
Analyze Command
DBMS_STATS Package
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 7 of 17
:
CORRECT
To update statistics for an index, you can use the DBMS_STATS package.
Example:
SQL
Explanation:
Replace 'my_schema' and 'my_table' with the actual schema and table names.
False
TRUE
CORRECT
A) Statistics that are outdated and do not re!ect the current state of the index.
B) Statistics that are corrupted and do not match the index structure.
C) Statistics that are missing and do not exist for the index.
D) Statistics that are invalid and do not comply with the optimizer rules.
Correct Answer:A: Stale statistics are statistics that are outdated and do not
re$ect the current state of the index. This can happen when the index
undergoes signi"cant changes, such as inserts, updates, deletes, or splits.
Incorrect Answers
(B) Incorrect. Statistics that are corrupted and do not match the index
structure are not stale, but invalid. This can happen due to bugs or errors in
the statistics collection process. Incorrect. Statistics that are missing and do
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 8 of 17
:
not exist for the index are not stale, but absent. This can happen when the
index is newly created or the statistics are explicitly deleted3. (D) Incorrect.
Statistics that are invalid and do not comply with the optimizer rules are not
stale, but inconsistent. This can happen when the statistics are manually
modi"ed or manipulated.
CORRECT
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 9 of 17
:
the performance of queries that use the index, as the optimizer may choose
suboptimal execution plans. Therefore, it is important to keep the statistics
up-to-date and accurate
INCORRECT
How can you prevent statistics from becoming stale on an index that is frequently
updated?
C) By enabling the monitoring of the index using the ALTER INDEX … MONITORING USAGE
statement.
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 10 of 17
:
job or run it manually. Incorrect. By enabling the monitoring of the index, you
can track how often the index is used by queries. This can help you identify
unused or rarely used indexes that can be dropped or made invisible.
However, this does not a#ect the statistics on the index or their freshness.
INCORRECT
How can you fix the performance issues caused by stale statistics on an index?
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 11 of 17
:
or consistent for the target table and index. (D) Incorrect. By using the
DBMS_STATS.SET_INDEX_STATS and DBMS_STATS.GET_INDEX_STATS procedures,
you can manually modify and view the statistics on the index. However, this is
not a recommended way to "x stale statistics, as the statistics may not be
accurate or consistent for the index.
INCORRECT
Question: How can you enable the monitoring of an index to track its usage by
queries?
INCORRECT
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 12 of 17
:
How can you check if an index is being used by any query or not?
Correct Answer:B : By querying the V$SQL_PLAN view, you can see the
execution plan of any SQL statement in the shared pool, including the indexes
used by the statement. You can "lter the view by the index name or the object
ID to see if the index is being used by any query or not.
Incorrect Answers:
(A) Incorrect. There is no such view as V$INDEX_USAGE. The correct view is
V$OBJECT_USAGE, which shows the usage information of indexes that are
being monitored. Incorrect. There is no such view as V$INDEX_STATS. The
correct view is V$INDEXES, which shows the information about all indexes in
the database, such as the index type, status, or uniqueness5. (D) Incorrect. By
querying the V$SQL_PLAN_STATISTICS view, you can see the runtime statistics
of any SQL statement in the shared pool, such as the number of rows
processed, the bu#er gets, or the CPU time. Remember that monitoring and
checking the usage of indexes can help you improve the performance of
queries that use the index, as well as identify and eliminate unnecessary
indexes.
INCORRECT
Index Rebuild ONLINE (During this the exclusive lock will be applied
on the table, which will impact DDL and
DMLS.)ALTER INDEX
SCHEMA_NAME.INDEX_NAME
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 13 of 17
:
REBUILD;Alternatively we can drop and recreate
the index . (DML and DDLS operations will
work as usual, without any impact)
Index REbuild OFFLINE DML and DDLS operations will work as usual,
without any impact ((During this the exclusive
lock will be applied on the table, which will
impact DDL and DMLS.)ALTER INDEX
SCHEMA_NAME.INDEX_NAME
REBUILD;Alternatively we can drop and
recreate the index .)
INCORRECT
Create index , generates a lot of redo and these logs are of no use. So we can create the
create the index with nologgin as below.
D. A, B Both
CORRECT
Rowid is pseudocolumn, which contains below information.ROWID is used to get the exact
location of a row in the database.It is the fasterst way to locating a row.
When we create index, the rowids and the column_values are stored in the leaf block of the
index.
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 14 of 17
:
1. object_id
2. block number
3. position of the row in the block
4. datafile number in which the row resides.(i.e relative file number)
A. TRUE
B. FALSE
CORRECT
A. TRUE
B. FALSE
When we move the table , the rows moved to a di#erent location and gets a
new rowid. But Index still points to the old rowids. So we need to rebuild the
index, which will make the index entries to use new set of rowids for the table
row. Di#erent reasons for index unusable is dropping table partition/truncate
partition.
CORRECT
B. Prior to 12c, it was not allowed to have two indexes on same column. However from
12c onwards , we can create two indexes on same column, but the index_type should be
di#erent. i.e if i have already btree index on a column, then other index should be a bitmap.
CORRECT
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 15 of 17
:
How can I do that?
B. We can alter the index with MONITORING USAGE clause. After the respective index
usage will be tracked.
CORRECT
CORRECT
Normal Index Scan db $le sequential read (wait event in AWR)
Index Fast Full Scan db $le scattered read (wait event in AWR)
CORRECT
Because, index rebuild need twice the size to complete the activity. Also it will generate lot
of redo during the activity and there might be impact on CPU usage.
A. TRUE
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 16 of 17
:
B. FALSE
https://dbvidya.talentlms.com/unit/viewtestsurvey/id:3198,mode:test 05/08/24, 6 19 PM
Page 17 of 17
: