전체 글
-
[Cassandra] BatchOps insert if exist 컬럼에 null로 업데이트 하고 싶을 때Computer Science/Cassandra 2024. 6. 15. 17:50
Cassandra BatchOps Write Option에 대하여Cassandra에서 insert, update는 둘 다 upsert 방식으로 동작하기 때문에 근본적으로는 큰 차이가 없습니다. 자세히 들어가면 약간의 차이가 있지만 해당 내용은 이 글에서 다루지 않겠습니다.(참고 Link)cassandraTemplate.batchOps() .insert(Entities) .insert(Entities2) .execute();카산드라에서 batchOps를 통해서 경량 트랙잭션을 사용하여 원자성을 보장하도록 저장할 수 있습니다.존재하지 않는 PK에 대하여 INSERT -> 저장존재하는 PK에 대하여 INSERT -> 업데이트 위처럼 동작하게 될텐데 존재하는 PK의 row 필드 중에서 값이 존재..
-
[Cassandra] Cassandra Insert와 Update 차이가 무엇일까?Computer Science/Cassandra 2024. 4. 20. 00:07
Cassandra Insert와 Update 차이가 무엇일까? 카산드라는 append 모델을 사용하기 때문에 INSERT와 UPDATE 작업 사이에 근본적인 차이가 없습니다. 기존 행에 존재하는 PK와 동일한 데이터를 INSERT 하면 UPDATE가 되고 UPDATE를 했는데 PK가 존재하지 않으면 신규 row를 생성한다는 특징을 가지고 있습니다. 실제 테스트를 해보면서 INSERT, UPDATE 각각 어떤 특징을 가지고 있는지 좀 더 알아보겠습니다. (테스트 Cassandra 버전: 4.0.6) CREATE TABLE experiment ( id text PRIMARY KEY, info text); 카산드라 테이블 하나를 생성 하겠습니다. 그리고 2가지 경우의 쿼리를 실행 해보겠습니다. Part1 IN..
-
[Cassandra] Cassandra truncate 이후 snapshot 제거Computer Science/Cassandra 2024. 4. 10. 21:57
Cassandra truncate 이후 snaptshot 제거 truncate TRUNCATE test_keyspsace.user_activity; 카산드라에서도 truncate 명령어로 테이블의 데이터를 지울 수 있다. 하지만 데이터를 다시 복구해야 할 수도 있기 때문에 스냅샷이라는 데이터를 남겨놓는다. 즉, truncate 한다고 해서 바로 Disk 사용량이 줄어들지 않고 스냅샷을 제거해야 서버의 Disk 사용량이 줄어들게 된다. snapshot 제거 ./nodetool clearsnapshot {keyspace} --all ex) ./nodetool clearsnapshot test_keyspsace --all Cassandra TRUNCATE 작업 후에 위의 명령어로 SNAPSHOT 제거도 필요하..
-
[MySQL] MySQL 인덱스 컨디션 푸시다운이란?Computer Science/Database 2024. 4. 10. 01:42
MySQL 인덱스 컨디션 푸시다운 이란? MySQL 5.6 버전부터는 인덱스 컨디션 푸시다운(Index Condition Pushdown) 이라는 기능이 도입 되었는데요. 어떤 내용인지 알아보겠습니다. 인덱스 컨디션 푸시 다운 secondary index에만 사용됩니다. 전체 row 읽기의 수를 줄여 I/O 작업을 줄이는 것. 인덱스를 범위 제한 조건으로 사용하지 못하는 쿼리에 한해서 발생하는 것 같음 (LIKE %name%, like > 10 같이 인덱스를 이용하지 못하는 범위 검색을 의미하는 것 같음) InnoDB Clustered index의 경우, 전체 레코드가 InnoDB 버퍼에 존재하기 때문에, 인덱스 컨디션 푸시다운을 사용해도 I/O가 감소하지 않음 MySQL SQL 수행 절차 MySQL 엔..