분류 전체보기
-
Real My SQL 8.0 읽고 공부하기 - ⑤-①,② 트랜잭션SQL 공부/MySQL 8.0 2023. 8. 27. 11:31
● 잠금 잠금은 동시성을 제어하기 위한 기능이다. 하나의 회원 정보 레코드를 여러 커넥션에서 동시에 변경하려고 하는것을 방지한다. 이것을 해주지 않으면 해당 레코드 값을 예측해줄 수 없다. 1) 트랜잭션 트랜잭션은 작업의 완전성을 보장해주는 것, 논리적인 작업 셋을 완벽히 처리하거나 처리하지 못할 경우 원상태로 복구해서 작업의 일부만 적용되는 현상(Partial update)이 발생하지 않게 해준다. ● 격리 수준 하나의 트랜잭션 내에서 혹은 여러 트랜잭션 간의 작업 내용을 어떻게 공유하고 차단할 것인지 결정하는 레벨 1. MySQL에서의 트랜잭션 트랜잭션은 하나의 논리적인 작업셋에 하나의 쿼리가 있든지, 두 개 이상의 쿼리가 있든 관계없이 해당 논리적인 작업 셋 자체가 100% 적용 혹은 아무것도 적용..
-
Real My SQL 8.0 읽고 공부하기 - ④-③,④ InnoDB 스토리지 엔진 아키텍처SQL 공부/MySQL 8.0 2023. 8. 20. 13:16
③ MyISAM 스토리지 엔진 아키텍처 1) 키 캐시 InnoDB의 버퍼풀과 비슷한 역할을 하지만, 인덱스 대상으로만 작동한다. 그리고 쓰기 작업에 대해서만 부분적 버퍼링 역할을 한다. 키캐시 히트율은 100 - (Key_reads / Key_read_requests * 100) 로 알 수 있다. Key_reads 는 인덱스를 디스크에서 읽어들이는 횟수를 저장하는 상태 변수, Key_read_requests는 키캐시로부터 인덱스를 읽은 횟수를 저장하는 상태 변수이다. (SHOW GLOBAL STATUS로 알수 있다.) 키 캐시 히트율은 99% 이상을 권장하며 미만이면 키 캐시 공간을 늘려야한다. 키 캐시는 영역설정을 해주어야 하는데, 어떤 스키마의 어떤 테이블의 인덱스를 캐시할지 설정을 해주어야한다. 2..
-
Real My SQL 8.0 읽고 공부하기 - ④-② InnoDB 스토리지 엔진 아키텍처SQL 공부/MySQL 8.0 2023. 8. 16. 02:35
1) 프라이머리 키에 의한 클러스터링 InnoDB엔진의 모든 테이블은 프라이머리 키값 순서대로 디스크에 저장되며, 모든 세컨더리의 인덱스는 레코드의 주소 대신 프라이머리 키의 값을 논리적 주소로 사용한다. 프라이머리 키가 클러스터링 인덱스이기 때문에 해당 키를 이용한 레인지스캔은 상당히 빠르다. 또한 쿼리 실행계획에서 프라이머리키가 다른 보조 인덱스보다 선택될 확률이 높다. MyISAM엔진에서는 클러스터링 키를 지원하지 않아서 프라이머리 키와 세컨더리 인덱스와의 구조적 차이가 없다. 단지 유니크키를 가진 세컨더리 인덱스일 뿐이다. 2) 외래키 지원 MyISAM이나 MEMORY 엔진은 외래 키를 지원하지 않는다. InnoDB에서 외래 키는 부모 테이블과 자식테이블 모두 해당 컬럼에 인덱스 생성이 필요하고 ..
-
Real My SQL 8.0 읽고 공부하기 - ③ 아키텍처SQL 공부/MySQL 8.0 2023. 8. 8. 01:46
SELECT thread_id, name, type, processlist_user, processlist_host FROM performance_schema.threads ORDER BY type, thread_id; 1) MySQL 엔진 아키텍처 MySQL은 C API, JDBC, ODBC, .NET 표준 드라이버를 제공하며 각종 언어를 지원한다. MySQL 서버는 크게 MySQL 엔진과 스토리지 엔진으로 구분할 수 있다. ● MySQL 엔진 클라이언트로부터 접속 및 쿼리요청을 처리하는 커넥션 핸들러와 SQL파서 및 전처리기, 쿼리의 최적화된 실행을 위한 옵티마이저가 주로 이룬다. MySQL은 표준 SQL 문법 (ANSI SQL)을 지원하기 때문에 타 DBMS와 호환된다. ● 스토리지 엔진 MySQL..
-
Real My SQL 8.0 읽고 공부하기 - ② 사용자 및 권한SQL 공부/MySQL 8.0 2023. 7. 31. 02:53
1. 사용자 식별 MySQL의 사용자는 사용자의 접속지점 (클라이언트가 실행된 호스트명 혹은 도메인 또는 IP 주소)이 계정의 일부가 된다. 'cdt'@'127.0.0.1' 이면 서버와 같은 IP에서 cdt라는 아이디로 접속할 수 있다는 것을 의미한다. 만약 모든 IP를 접속 허용 가능하게 하고 싶다면 'cdt'@'%' 로 진행하면 된다. 만약 'cdt'@'%'와 'cdt'@'192.168.0.1' 이있다면 우선 순위는 조금 더 명확한 주소를 가진 'cdt'@'192.168.0.1'로 접속을 시도하므로 유의하여야 한다. 2. 사용자 계정 관리 1) 시스템 계정과 일반 계정 MySQL은 SYSTEM_USER 권한 여부에 따라서 시스템 계정과 일반 계정을 구분한다. 일반적으로 시스템 계정은 데이터베이스 서버..
-
Real My SQL 8.0 읽고 공부하기 - ① 설치하기 (Window 10)SQL 공부/MySQL 8.0 2023. 7. 29. 07:11
MySQL :: Download MySQL Installer 에서 용량이 큰 msi 파일을 다운을 받는다. 설치 파일을 실행 후 Custom을 선택하여 My SQL Server MySql Shell MySQL Router를 설치하자. 이후 설정들은 책에 나와있는데로 설정하고 설치하였다. windows에서는 cmd에서 MySql명령어를 치려면 환경변수를 등록을 해주어야한다. 내 PC 우클릭 -> 속성 -> 고급 시스템 설정 -> 환경 변수 -> 시스템 변수의 Path 수정 C:\Program Files\MySQL\MySQL Server 8.0\bin (사용자마다 다를 수 있음) 등록 하면 끝난다. 1) 초기화 책에서 첫부분에 알려주는 초기화를 진행한다. ##linux mysqld --defaults-fil..
-
'오브젝트' 책 보고 공부하기 - (부록C) 동적인 협력, 정적인 코드JAVA공부/JAVA 2023. 7. 19. 21:55
프로그래머는 객체지향 프로그램을 작성하기 위해서 동적 모델과 정적 모델을 그려야 한다. 동적모델은 프로그램 실행 구조를 표현하는 움직이는 모델이며 객체와 협력 으로 구성되고 정적모델은 코드의 구조를 담는 고정 모델이며 타입과 관계로 구성된다. 동적모델을 토대 위에 정적 모델을 설계해서 변경에 유연한 코드를 만들어야 한다. 1) 동적 모델과 정적 모델 객체의 행동이 코드를 결정한다. 객체가 외부에 전달하는 행동이 중요하기 때문에 동적 모델이 정적모델을 결정하게 만들어야한다. 만약 정적 모델이 협력에 적합하지 않다면 정적 모델을 지속적으로 개선해야한다. 그러나, 객체가 제공하는 행동 측면에서 적절한 정적 모델을 고려하더라도 변경이 고려되지 않는다면 유지보수하기가 어려워진다. 2) 도메인 모델과 구현 도메인이..
-
'오브젝트' 책 보고 공부하기 - (부록B) 타입 계층의 구현JAVA공부/JAVA 2023. 7. 19. 01:57
1) 다양한 타입 계층 구현 ● 클래스를 이용한 타입 계층 구현 타입을 구현할 수 있는 방법이 단 한가지 방법만 존재하는 경우 타입과 클래스를 동일하게 취급한다. 만약 Car라는 클래스와 인터페이스는 동일하지만 다른방식으로 구현해야 하는 객체가 필요하다면 즉, 구현은 다르지만 동일한 타입으로 분류되는 객체가 필요하면 상속을 이용하면 된다. 그러나, 자식클래스를 부모 클래스의 구현에 강하게 결합시키기 때문에 구체 클래스를 상속받는 것을 피하고 추상 클래스, 인터페이스를 이용해야한다. 그리고 대부분의 언어에서의 클래스의 다중 상속을 지원하지 않기 때문에 다양한 타입으로 사용이 불가능하다. ● 인터페이스를 이용한 타입계층 구현 위에서 발생하는 다중 상속 지원하지 않는 문제와, 결합도 문제를 피할 수 있는 방법..