If there are some problems due to execution plan and data statistics info,  you can fix the sql plan using hint.

 

1. use index : possible to use defined index

SELECT * FROM employees USE INDEX (PRIMARY) WHERE emp_no=10001;

 

2. staright_join : have to join the order of table which display in sql.

SELECT STRAIGHT_JOIN * FROM employees e, dept_emp de, departments d WHERE e.emp_no=de.emp_no AND d.dept_no=de.dept_no

 

3. force index : must be used index
SELECT * FROM employees FORCE INDEX(primary) WHERE emp_no=10001;

 

4. ignore index : ignore the index of table which display the sql plan.

SELECT * FROM employees IGNORE INDEX(primary) WHERE emp_no=10001;

'RDB > MySQL' 카테고리의 다른 글

MySQL process debug  (0) 2020.07.27
MySQL online DDL  (0) 2020.07.27
MySQL spool output  (0) 2020.07.08
Mariadb event scheduler  (0) 2020.07.06
MySQL table / column rename  (0) 2020.06.29

+ Recent posts