전체 글

준비물 docker postgre 시작 create table temp(t int); insert into temp(t) select random() * 100 from generate_series(0, 1000000); select t from temp limit 10; 백만건의 데이터를 생성!
· 에러일기
문제점 "psql" does not exist docker로 실행한 postgres db에 연결이 안 되는 문제가 발생! 소켓에서 서버에 연결합니다. 실패, 데이터베이스 "psql"이 존재하지 않습니다. 라는 에러가 발생 해결 https://yeojin-dev.github.io/blog/postgresql-ubuntu/ Ubuntu 환경에서 PostgreSQL 설치 후 리모트 접속하기 YEOJIN-DEV yeojin-dev.github.io psql --username=postgres --dbname=postgres 이렇게 입력해주면 현재 시스템 유저와 같은 이름으로 PostgreSQL을 사용할 수 있다고 한다.
저장소 개념 Table Row_id Page IO Heap data structure Index data structure b-tree Table EMPLOYEE_ID (Row_id) 특정 행을 고유하게 식별 Postgres : 튜플 ID Page Storage Model(row vs column store)에 따라 행은 논리적 페이지에 저장되고 읽혀진다. 데이터베이스는 단일 행을 읽는 것이 아니라, 단일 IO에서 한 페이지 이상을 읽으며, 해당 IO에서 많은 행을 얻는다. 우리 눈에는 두개의 행만 골라서 읽어온 것처럼 보이지만, 페이지 단위로 저장되어 있는 전체 영역을 스캔하며 필요한 행을 가지고 온 것. Page Size는 DB마다 다르다. (e.g. 8KB in postgres, 16KB in My..
· 프로젝트
문제점이 있었던 코드 댓글을 저장하는 로직 @Transactional public void create(CommentCreateRequestDto requestDto, User user) { Long postId = requestDto.getPostId(); Post post = findPostByPostId(postId); Comment child = requestDto.toEntity(user, post); requestDto.getCommentIdOptional().ifPresent(commentId -> linkParent(commentId, child)); commentRepository.save(child); post.increaseCommentCount(); } 게시글과 댓글의 관계에서 1개..
이기종 마이그레이션을 진행할 일이 생겼다. 여러 방법을 찾아봤는데, FlyWay https://flywaydb.org/ Homepage - Flyway Version control for your database. Robust schema evolution across all your environments. With ease, pleasure, and plain SQL. flywaydb.org 장점으로는 내가 좋아하는 Spring Boot에서 쓸 수 있다. 하지만 운영 소스 코드를 건드려야 하는데 그건 못하기 때문에 탈락 Flyway Desktop이라고 이관을 해주는 툴이 있는데 결국은 변환된 Script가 필요하다. DDL만 수행해주는 것이기 때문에 탈락 직접 해봤고, 테이블 이관은 해주는데 데이터 ..
· 에러일기
문제 발생 Execution failed for task ':test'. > Could not resolve all files for configuration ':testRuntimeClasspath'. > Could not find com.mysql:mysql-connector-j:. Required by: project : Gradle에 // mysql runtimeOnly 'com.mysql:mysql-connector-j' 이 코드 추가하고, 클린 빌드 수행 했을 때 저런 문제가 발생했습니다. 원인 https://nayha.tistory.com/740 인텔리제이 could not find mysql:mysql-connector-java gradle could not find mysql:mysql-..
솜사탕코튼
개발일기