반응형

=================================================================================

* 참고

=================================================================================

http://dev.mysql.com/doc/internals/en/optimizer-tracing.html


OOW2013 - [TUT8131] Enhancing Productivity with MySQL 5.6 New Features.pptx

- https://oracleus.activeevents.com/2013/connect/sessionDetail.ww?SESSION_ID=8131

=================================================================================


use test;


drop table if exists big_table;


create table big_table

as

select a.*

  from information_schema.columns a

      ,information_schema.columns b

      ,information_schema.columns c

 limit 1000000;


select count(*) from big_table;



[출처] MySQL NF 5.6 - Enhanced tracing (SQL Trace 방법) (MySQL Power Group) |작성자 29babo

http://cafe.naver.com/mysqlpg/105



drop procedure if exists test_proc;


delimiter //


create procedure test_proc()

begin

   set @s = "";

   select 'select count(*) from big_table' into @s;

   prepare stmt from @s;

   execute stmt;

end

//


delimiter ;


call test_proc();




SET OPTIMIZER_TRACE="enabled=on",END_MARKERS_IN_JSON=on;

set optimizer_trace_limit        =  100;

set optimizer_trace_offset       = -100;

SET optimizer_trace_max_mem_size = 1000000;


select *               from big_table where column_name = 'CHARACTER_SET_NAME' limit 10;

select count(*) as cnt from big_table where column_name = 'CHARACTER_SET_NAME';

call test_proc();


# possibly more queries...

# When done with tracing, disable it:


SET optimizer_trace="enabled=off";


SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;



반응형

'연구개발 > MYSQL' 카테고리의 다른 글

Linux time. (real, user, sys)  (0) 2015.02.10
[모니터링] 쿼리  (0) 2015.02.10
CentOS7 hostname 변경  (0) 2015.02.07
MySql Binlog 파일 복구시 원하는 쿼리문만 가공하여 추출하기..  (0) 2015.02.06
aws fdisk  (0) 2015.02.05

+ Recent posts