Upgrade to Pro — share decks privately, control downloads, hide ads and more …

mysql-2

garimoo
February 03, 2021

 mysql-2

garimoo

February 03, 2021
Tweet

More Decks by garimoo

Other Decks in Technology

Transcript

  1. QnA Q1. 풀 텍스트 검색 / 공간 검색을 사용하는 곳이

    있나요? Q2. 사용자 정의 변수를 서비스에서 사용하는 곳이 있나요? 07 쿼리 작성 및 최적화
  2. 06 실행 계획 실행 계획 분석 - select_type SIMPLE PRIMARY

    UNION DEPENDENT UNION UNION RESULT SUBQUERY DEPENDENT SUBQUERY DERIVED UNCACHEABLE SUBQUERY UNCACHEABLE UNION
  3. 06 실행 계획 실행 계획 분석 - select_type SIMPLE PRIMARY

    UNION DEPENDENT UNION UNION RESULT SUBQUERY DEPENDENT SUBQUERY DERIVED UNCACHEABLE SUBQUERY UNCACHEABLE UNION UNCACHEABLE SUBQUERY UNCACHEABLE UNION
  4. 06 실행 계획 실행 계획 분석 - table SELECT *

    FROM (SELECT de.emp_no FROM dept_emp de) tb,
 employees e WHERE e.emp_no = tb.emp_no;
  5. 06 실행 계획 실행 계획 분석 - type system ref

    unique_subquery index_merge const fulltext index_subquery index eq_ref ref_or_null range ALL
  6. 06 실행 계획 실행 계획 분석 - type system ref

    unique_subquery index_merge const fulltext index_subquery index eq_ref ref_or_null range ALL eq_ref
  7. 06 실행 계획 실행 계획 분석 - Extra const row

    not found Distinct Full scan on NULL key Impossible HAVING Impossible WHERE Impossible WHERE noticed after reading const tables no matching min/max row no matching row in const table No table used Not exists Range checked for each record Scanned N databases
  8. 06 실행 계획 실행 계획 분석 - Extra const row

    not found Distinct Full scan on NULL key Impossible HAVING Impossible WHERE Impossible WHERE noticed after reading const tables no matching min/max row no matching row in const table No table used Not exists Range checked for each record Scanned N databases col1 (SELECT col2 FROM …) Full scan on NULL key
  9. 06 실행 계획 실행 계획 분석 - Extra const row

    not found Distinct Full scan on NULL key Impossible HAVING Impossible WHERE Impossible WHERE noticed after reading const tables no matching min/max row no matching row in const table No table used Not exists Range checked for each record Scanned N databases Full scan on NULL key Range checked for each record
  10. 06 실행 계획 실행 계획 분석 - Extra Select tables

    optimized away Skip_open_table, Open_frm_only, Open_trigger_only, Open_full_table Unique row not found Using filesort Using index Using index for group-by Using join buffer Using sort_union, Using union, Using intersect Using temporary Using where
  11. 06 실행 계획 실행 계획 분석 - Extra Select tables

    optimized away Skip_open_table, Open_frm_only, Open_trigger_only, Open_full_table Unique row not found Using filesort Using index Using index for group-by Using join buffer Using sort_union, Using union, Using intersect Using temporary Using where Using where
  12. 03 아키텍처 QnA Q1. 쿼리 튜닝할 때에 보이면 무조건 바꿔야

    하는 구문이 있나요? Q2. 이 정도면 쿼리 튜닝 다 됐다 하는 지표가 있을까요?
  13. 06 실행 계획 쿼리 처리 방식 - 풀 테이블 스캔

    레코드 건수가 작을 때 인덱스를 사용할 수 없을 때 인덱스 일치 레코드 건수가 너무 많을 때 䢗 READ AHEAD
  14. 06 실행 계획 쿼리 처리 방식 - distinct SELECT DISTINCT

    emp_no FROM salaries; SELECT emp_no FROM salaries GROUP BY emp_no; SELECT COUNT(DISTINCT s.salary)
 FROM employees e, salaries s WHERE e.emp_no = s.emp_no …