Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

No table is provided; OE.CUSTOMERS IS PART OF THE DBA_table view : following are example used in the lesson : --your query; / SELECT PLAN_TABLE_OUTPUT

No table is provided; OE.CUSTOMERS IS PART OF THE DBA_table view : following are example used in the lesson :

--your query;

/

SELECT PLAN_TABLE_OUTPUT FROM TABLE (DBMS_XPLAN.DISPLAY());

Or in SQL developer click Explain Plan (F10) icon on the toolbar.

Example using EXPLAIN PLAN

EXPLAIN PLAN FOR

SELECT COUNT(*) FROM oe.customers c;

SELECT PLAN_TABLE_OUTPUT FROM TABLE (DBMS_XPLAN.DISPLAY());

The result

The result shows that full scan of CUSTOMERS_PK was used. It took 1 sec.

Example using SQL Developer Explain Plan

There results are the same, but presented differently. SQL Developer Explain Plan all so allows to compare two execution palns.

Find all indexes for OE.CUSTOMERS table

SELECT * from DBA_IND_COLUMNS WHERE TABLE_OWNER='OE' and TABLE_NAME='CUSTOMERS';

Compare different queries using EXPLAIN PLAN

1.Study the structure of SH.CUSTOMERS table. This table is part of the same sample schema as OE.CUSTOMERS

What query did you use? Provide code of the query and screenshot of the results.

2.Find all indexes on SH.CUSTOMERS table. You might need to use several data dictionary views to find all information required.

Provide code of all queries and screenshots of the results.

Index name

Column Name

Index Type

https://docs.oracle.com/cd/E11882_01/server.112/e40540/indexiot.htm#CNCPT1170

3.Find how many rows in SH.CUSTOMERS table have information about customers whose last name contains "ltz".

What query did you use? Provide code of the query and screenshot of the results.

4.Find an execution plan for the previous query. Pin the execution plan.

Provide a screenshot and an explanation of the observed results.

5.Add index to SH.CUSTOMERS table. The index should combine customers' first name and last name.

What query did you use? Provide code of the query and screenshot of the results.

6.Find how many rows in SH.CUSTOMERS table have information about customers whose last name contains "ltz".

What query did you use? Provide code of the query and screenshot of the results.

7.Find an execution plan for the previous query.

Provide a screenshot and an explanation of the observed results.

8.Compare execution plans for both queries (before and after the index).

Provide a screenshot and an explanation of observed results.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

Pick a Fortune 500 company and do a summary report on it.

Answered: 1 week ago

Question

1. Select the job or jobs to be analyzed.

Answered: 1 week ago