DO USING SQL DEVELOPER. SELECT PLAN_TABLE_OUTPUT FROM TABLE (DBMS_XPLAN.DISPLAY(
ID: 3854504 • Letter: D
Question
DO USING SQL DEVELOPER.
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.
Index name
Column Name
Index Type
Explanation / Answer
The output of these queries vary from machine to machine so execute the attached queries and take screen shots for the results for better accuracy.
1 DESC sh.customers
2select
b.uniquen, a.index_name, a.table_name, a.column_name
from all_ind_columns a, all_indexes b
where a.index_name=b.index_name
and a.table_name = upper('sh.customers')
order by a.table_name, a.index_name, a.column_position;
CHANNELS_PK
COSTS_PROD_BIX
COSTS_TIME_BIX
COUNTRIES_PK
CUSTOMERS_GENDER_BIX
CUSTOMERS_MARITAL_BIX
CUSTOMERS_PK
CUSTOMERS_YOB_BIX
DR$SUP_TEXT_IDX$X
FW_PSC_S_MV_CHAN_BIX
FW_PSC_S_MV_PROMO_BIX
FW_PSC_S_MV_SUBCAT_BIX
FW_PSC_S_MV_WD_BIX
PRODUCTS_PK
PRODUCTS_PROD_CAT_IX
PRODUCTS_PROD_STATUS_BIX
PRODUCTS_PROD_SUBCAT_IX
PROMO_PK
SALES_CHANNEL_BIX
SALES_CUST_BIX
SALES_PROD_BIX
SALES_PROMO_BIX
SALES_TIME_BIX
SUP_TEXT_IDX
SYS_IOT_TOP_45927
SYS_IOT_TOP_45932
TIMES_PK
3)
select count(*) from SH.CUSTOMERS where CUST_LAST_NAME like '%ltz%'
4)EXPLAIN PLAN FOR select count(*) from SH.CUSTOMERS where CUST_LAST_NAME like '%ltz%'
SELECT PLAN_TABLE_OUTPUT FROM
TABLE (DBMS_XPLAN.DISPLAY());
6)select count(*) from SH.CUSTOMERS where CUST_LAST_NAME like '%ltz%'
5)CREATE INDEX sh_cust_first_last
ON sh.customers(concat(cust_first_name,cust_last_name));
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.