Sunteți pe pagina 1din 2

What is an execution plan in Oracle?

The EXPLAIN PLAN statement displays execution plans chosen by the Oracle optimizer
for
SELECT , UPDATE , INSERT , and DELETE statements. A statement's execution plan is
the sequence of operations
Oracle performs to run the statement.

What is an explain plan?


Introduction to EXPLAIN PLAN. The EXPLAIN PLAN statement displays execution plans
chosen by
the Oracle optimizer for SELECT, UPDATE, INSERT, and DELETE statements. A
statement's execution plan
is the sequence of operations Oracle performs to execute the statement.

explain plan for


select * from emp where deptno=20;
Explained

Elasped : 00:00:00

select * from table (dbms_xplan.display())

Plan_table_output
==================
Plan Table
--------------------------------------------------------------------------------
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
--------------------------------------------------------------------------------
| SELECT STATEMENT | | 1 | 39 | 4 | | |
| NESTED LOOPS | | 1 | 39 | 4 | | |
| NESTED LOOPS | | 1 | 27 | 3 | | |
| TABLE ACCESS BY INDEX R|INVOICE_I | 1 | 15 | 2 | | |
| INDEX UNIQUE SCAN |INVOICE_I | 2 | | 1 | | |
| TABLE ACCESS BY INDEX R|INVOICES | 2 | 24 | 1 | | |
| INDEX UNIQUE SCAN |INVOICES_ | 2 | | | | |
| TABLE ACCESS BY INDEX RO|CUSTOMERS | 100 | 1K| 1 | | |
| INDEX UNIQUE SCAN |CUSTOMERS | 100 | | | | |

Lower the cost---better the performance


Higher the cost---lower the performance

https://xhamster.com/movies/6747185/22_teachers_having_sex_in_school_part_2.html?
embed=related&utm_campaign=embed&utm_medium=6747185&utm_source=video-
one.com&from=player_related&prs=908643a1152719c69dc23bdb0315903b%3Avideo-one.com
%3A58ae9581%3Ae10
http://video-one.com/video/771a957c31ebe6e449740892c110e945.html?fid=Teacher

Writing sql queries in order


===============================
[ WITH <common_table_expression>]

SELECT select_list [ INTO new_table ]

[ FROM table_source ] [ WHERE search_condition ]

[ GROUP BY group_by_expression ]
[ HAVING search_condition ]

[ ORDER BY order_expression [ ASC | DESC ] ]

Syntax of SQL SELECT Statement:

SELECT column_list FROM table-name


[WHERE Clause]
[GROUP BY clause]
[HAVING clause]
[ORDER BY clause];

Index
=====
b-tree indexes are used for high cardinaties, usuall when we have too many distinct
columns.
and bitmap indexex are used for low cardinaties, usuallywhen we have repeated
columns

bitmap indexes are more advantageous than b-tree indexes when the table has
millions of rows and
the key columns have low cardinality.
bitmap indexes provide better performance than b tree indexes when queries often
use a combination of
multiple where conditions involving the OR operator, the table is read-only, or
when there is low update activity on the key columns.

S-ar putea să vă placă și