분류 전체보기
-
2024.08.09 index seekTIL 2024. 8. 11. 23:48
DataBaser.Net: Index Seek목차 1 Index Seek란? 2 총 몇 Page를 읽었는가? 3 Random Access란? 4 Random Access의 부하 5 Non-Clustered Index와 Clustered Index가 함께 존재한다면? 6 확인해 보자 7 unique vs non-unique 8 인덱스에 대한 오해들 9 인덱스databaser.net 이전에 lock을 다룰 때 인덱스 스캔에 대해서 이야기한적이 있습니다. 스캔된 인덱스가 모두 잠긴다는 것 입니다.쿼리의 실행 계획을보다보면 range scan이 노출됩니다. 단순 equals비교도 range scan이 보이는 이유는 무엇일까 궁금했습니다.Uk의 경우 단일값이라 index seek이라는 인덱스 탐색만 이뤄져도 될 ..
-
2024.08.08 index scan lockTIL 2024. 8. 8. 22:36
MySQL(InnoDB)이 잠금할 레코드를 고르는 방법MySQL 을 처음 공부할 때, 레코드 잠금에 관해서 여러가지 궁금한 점들이 많았다. 그동안 궁금했던 세부적인 부분들에 대해서 정리해보고자 한다.MySQL 은 기본적으로 잠금 읽기(locking read), update, depius712.tistory.com Index관련 문서를 보면 index scan에 걸리는 것들은 lock이 걸린다고 합니다.Where조건에 해당이 안되도 lock에 걸릴 수 있다는 것 입니다. 예로UPDATE t SET b = 3 WHERE b = 2 AND c = 3;해당 쿼리가 b인덱스만을 사용한다고 해봅시다.Where조건만보면 둘의 조건이 and인 것들만 lock이 걸릴 거 같지만 b=2인 것을은 모두 lock이 걸립니다...
-
2024.08.07 gap lockTIL 2024. 8. 7. 23:23
InnoDB의 Lock 처리 방식 - miintto.log필자가 속한 개발팀의 여러 Django 프로젝트에서는 데이터베이스의 동시성을 제어하기 위해 select_for_update() 메소드가 적용되어 있습니다. 비슷하게 SQLAlchemy 라이브러리에서는 with_for_update() 메소miintto.github.io Gap lock이 걸리는 쿼리는 많습니다.Pk,uk를 사용했다고 안걸리는 것이 아닌 데이터 유무, where 조건에 따라 결정되니다.Pk기준으로 Equals비교는 값의 유무에 따라 gap lock이 결정되니다.범위연산의 경우는 gap lock이 적용됩니다.이들은 phantom read에 영향이 있는 locking read, update, delete의 경우입니다.Insert는 gap ..
-
2024.08.06 Intention lockTIL 2024. 8. 6. 22:18
MySQL :: MySQL 8.4 Reference Manual :: 17.7.1 InnoDB LockingMySQL 8.4 Reference Manual / ... / The InnoDB Storage Engine / InnoDB Locking and Transaction Model / InnoDB Locking This section describes lock types used by InnoDB. Shared and Exclusive Locks InnoDB implements standard row-level locking wdev.mysql.com오늘도 이어서.. Intention lock은 테이블 수준의 lock으로 잠금의도를 나타내는 lock입니다. Sql에 따라 IS, IX l..
-
2024.08.05 Locks Set by SQL 3, INSERT INTO T SELECT ... FROM S WHERE..TIL 2024. 8. 5. 23:05
MySQL :: MySQL 8.0 Reference Manual :: 17.7.3 Locks Set by Different SQL Statements in InnoDB17.7.3 Locks Set by Different SQL Statements in InnoDB A locking read, an UPDATE, or a DELETE generally set record locks on every index record that is scanned in the processing of an SQL statement. It does not matter whether there are WHERE conditions in dev.mysql.com INSERT INTO ... SELECT Performance w..
-
2024.08.02~04 Locks Set by SQL 2TIL 2024. 8. 4. 17:12
MySQL :: MySQL 8.0 Reference Manual :: 17.7.3 Locks Set by Different SQL Statements in InnoDB17.7.3 Locks Set by Different SQL Statements in InnoDB A locking read, an UPDATE, or a DELETE generally set record locks on every index record that is scanned in the processing of an SQL statement. It does not matter whether there are WHERE conditions indev.mysql.com읽은 부분은 insert 시 발생하는 lock에 관한 부분입니다. I..
-
2024.08.01 Locks Set by SQLTIL 2024. 8. 1. 23:59
MySQL :: MySQL 8.0 Reference Manual :: 17.7.3 Locks Set by Different SQL Statements in InnoDB17.7.3 Locks Set by Different SQL Statements in InnoDB A locking read, an UPDATE, or a DELETE generally set record locks on every index record that is scanned in the processing of an SQL statement. It does not matter whether there are WHERE conditions indev.mysql.comgap lock을 공부하려 이거 저거 읽어보는 중.. sql에 따라 ..