Загрузка страницы

How to Find Slow SQL: Databases for Developers: Performance #9

In order to tune SQL, you need to know what the slow statement is. But often you're just told that "the database" is slow!

To find the slow components, you need a breakdown of how long each piece of code takes to execute. You can do this in Oracle Database using:

- A SQL trace
- The PL/SQL hierarchical profiler

This video shows you how to do these with Oracle SQL Developer.

The script to spool the trace file is:

-----
set serveroutput off
set pagesize 0
set echo off
set feedback off
set trimspool on
set heading off
set tab off
set long 1000000
spool c:\temp\student_trace.trc

select payload
from v$diag_trace_file_contents
where trace_filename = (
select substr (
value,
instr ( value, '/', -1 ) + 1
) filename
from v$diag_info
where name = 'Default Trace File'
)
order by line_number;

spool off

-----

Need help with SQL?

Ask us over on AskTOM: https://asktom.oracle.com

Twitter: https://twitter.com/ChrisRSaxon
Daily SQL Twitter tips: https://twitter.com/SQLDaily
All Things SQL blog: https://blogs.oracle.com/sql/
Test your SQL Skills on the Oracle Dev Gym: https://devgym.oracle.com/

============================
The Magic of SQL with Chris Saxon

Copyright © 2020 Oracle and/or its affiliates. Oracle is a registered trademark of Oracle and/or its affiliates. All rights reserved. Other names may be registered trademarks of their respective owners. Oracle disclaims any warranties or representations as to the accuracy or completeness of this recording, demonstration, and/or written materials (the “Materials”). The Materials are provided “as is” without any warranty of any kind, either express or implied, including without limitation warranties or merchantability, fitness for a particular purpose, and non-infringement.

Видео How to Find Slow SQL: Databases for Developers: Performance #9 канала The Magic of SQL
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
3 июля 2020 г. 16:24:54
00:11:16
Яндекс.Метрика