db + it ops db postgresql PostgreSQL 사용 시 도움 되는 패턴들 | GeekNewsPostgres를 더 생산적이고 안전하게 사용하는 데 도움이 되는 실용적인 패턴들을 정리한 글각 패턴은 작지만 누적되면 큰 차이를 만들어냄UUID 기본 키 사용UUID는 무작위이기 때문에 정렬이나 인덱스 성능 면에서 단점이 있음숫자 ID보다 공간을 더 많이 차지함하지만 다음과 같은 장점이 있음DB에 연결하지 않고도 UUID를 생성할 수 있음외부에 안전하게 wono | discuss | tweet + it ops db design history trigger [PostgreSQL] trigger 사용하기 (history table 만들기)참고 사이트 https://www.postgresql.org/docs/current/sql-createtrigger.html 얼마 전에 특정 table에 대한 변경 이력을 저장해야 하는 작업을 진행하면서 trigger를 처음 사용하 보았다. (A table에서 발생하는 insert, update row를 B table에 추가) 적용해야 하는 조건이 간단해서 trigger 적용도 간단하게 할 수 있었다. trigger 생성은 다음과 같이 선언한다. create trigger save_history after insert or update on A for each row execute procedure trigger_upsert_data(); - trigger 이름은 save_history로 선언 - ins.. wono | discuss | tweet + it ops db design history trigger 데이터 변경 이력 기록 및 효율적인 히스토리 추적 관리 전략데이터베이스에서 변경된 사항만 확인하는 구조를 만드는 방법은 여러 가지가 있습니다. 일반적인 RDBMS에서도 이러한 기능을 구현할 수 있지만, 특정한 요구사항에 따라 다른 접근 방법이 필요할 수도 있습니다.트리거(Trigger): 데이터베이스의 트리거 기능을 사용하여 데이터 변경 시 로그 테이블에 기록을 남기도록 설정할 수 있습니다. 이렇게 하면 변경 사항을 쉽게 추적할 수 있습니다.변경 데이터 캡처(Change Data Capture, CDC): 많은 RDBMS가 CDC 기능을 제공하여 테이블의 변경 사항을 캡처하고 이를 별도의 테이블이나 로그로 기록합니다. 이를 통해 변경된 데이터만 추출할 수 있습니다.타임스탬프 필드 사용: 테이블에 'last_updated'와 같은 타임스탬프 필드를 추가하여 레코드.. wono | discuss | tweet + it ops db design history trigger [ORACLE] 트리거(Trigger)를 이용한 테이블 수정 이력 관리데이터베이스에서 데이터의 변경 이력을 관리하는 것은 매우 중요하다.사용자가 데이터를 수정하거나 삭제하는 경우, 그 내역을 저장하여 추후에 어떤 변경이 있었는지 추적할 수 있어야 한다.이를 위해 Oracle에서는 트리거를 사용하여 테이블의 수정 이력을 관리할 수 있다.이번 포스팅에서는 트리거를 이용하여 수정 이력을 관리하는 방법을 알아보자. 1. 사용자 작업 테이블 생성먼저 사용자가 직접 데이터를 삽입(insert), 수정(update), 삭제(delete)할 수 있는 테이블을 생성한다.예를 들어, users 테이블이라고 가정하여 생성해 보자.(실제 운영 테이블은 예시와는 비교도 안될 정도로 복잡할텐데, 예시니까^^. 참조만 부탁드립니다)CREATE TABLE users ( id NUMBER PRIMAR.. wono | discuss | tweet + it ops db design history [디비] 추적 가능한 테이블 설계 : 네이버 블로그 wono | discuss | tweet + it ops db design history 관계형 데이터 모델링 노트 : 06 이력 데이터 이야기Chapter 6 : 이력 데이터 이야기 wono | discuss | tweet + it ops db design history '이력 엔터티를 설계하는 10가지 방법'의 검색결과 wono | discuss | tweet + it ops db history 데이터베이스 설계와 히스토리 테이블의 중요성이 글에서는 데이터베이스 설계의 중요성과 히스토리 테이블의 필요성, 설계 시 고려사항, 구현 예시, 장단점에 대해 설명합니다. wono | discuss | tweet + it ops db dbeaver erd Two ways to use ERD in DBeaverAn Entity Relationship (ER) Diagram is a type of flowchart that illustrates how entities relate to each other within a system. In terms of a database wono | discuss | tweet + it ops db dbeaver Rearrange columns in a simpler way · Issue #19042 · dbeaver/dbeaverIs your feature request related to a problem? Please describe. Its really hard to re-arrange the columns from the result set by drag and drop one by one or I have write the SQL according to the column arrange I required. Describe the sol... wono | discuss | tweet + it ops db kysely cte kysely/site/docs/recipes/0010-extending-kysely.md at a43b270cb6c88208d1d3f79b958e774deebe63f2 · kysely-org/kyselyA type-safe typescript SQL query builder. Contribute to kysely-org/kysely development by creating an account on GitHub. wono | discuss | tweet + it ops db kysely cte vaylaopas/src/server/db/db.ts at 3a6c28047e5d23c5196344a6beb5c44c5f51c38f · arttuka/vaylaopasContribute to arttuka/vaylaopas development by creating an account on GitHub. wono | discuss | tweet + it ops db kysely How to write "SELECT 1 FROM tablename" - KyselyI want to create subquery for exists but don't know type select(1)...? should I use val or sql.lit or other way...? Thanks in advance https://kyse.link/?p=s&i=rF7gNapHXGQFdbmhVHJx wono | discuss | tweet + it ops db kysely Merge temp table as source table · Issue #959 · kysely-org/kyselyIs there a way to use temp table as the source table in merge statement something like this? await db.mergeInto('mainTable').using('tempData', 'mainTable.itemCode', 'tempData.itemCode').whenMatched()...... SQL Statement MERGE INTO MainTa... wono | discuss | tweet + it ops db kysely merge JSON utilities for `selectNoFrom` · Issue #1294 · kysely-org/kyselyDiscussed in https://discord.com/channels/890118421587578920/1315878442281209907/1315878442281209907 Currently, all the json utilities expect a column. While it is possible to use these utilities via CTEs: const exampleJson = { foo: { ba... wono | discuss | tweet + it ops db merge MERGE 문 사용법 (DUAL, UPDATE와 INSERT를 한번에)MERGE 문을 사용하면 변경할 테이블에 데이터가 존재하는지 체크하고, UPDATE, DELETE, INSERT를 한 번에 작업이 가능하다. MERGE 문을 사용하지 않을 경우 해당 조건으로 테이블을 SELECT 한 후 IF 조건을 사용하여 UPDATE나 INSERT로 분기하는 로직을 작성해야 하는 번거로움이 있다. MERGE 문의 경우 단일(한개의) 테이블에 UPDATE 또는 INSERT를 하는 경우 많이 사용하지만, 두개의 테이블을 비교하거나 서브 쿼리의 결과에 따라서 UPDATE, INSERT 작업이 가능하다. MSSQL MERGE 문 단일 테이블 사용법 (DUAL) 오라클에서는 DUAL이라는 dummy 테이블을 USING 절에 사용하면 단일 테이블 작업이 간단하지만, MSSQL에서는 DUAL 테이.. wono | discuss | tweet + it ops db postgresql merge PostgreSQL 15にMERGE文UPSERTがやってくる | DevelopersIOPostgreSQL 15がMERGE文を使ったUPSERTに対応します wono | discuss | tweet + it ops db postgresql merge Postgresql 로 Upsert 하기Postgres 9.5(2016년 1월 7일 이후 출시) 이후 가능한 문법입니다.존재하지 않는 경우 삽입, 존재하는 경우 Nothing존재하지 않는 경우 삽입, 존재하는 경우 Update삽입이 되었으면, id 반환삽입이 된 경우 삽입된 id값을 반환한다.Serial, wono | discuss | tweet + it ops db softdelete postgresql Soft deletion with PostgreSQL: but with logic on the database!—Martian Chronicles, Evil Martians’ team blogRubyists might take special pleasure here, but every SQL and PostgreSQL dev can learn this unorthodox approach: putting soft delete logic on the database side. wono | discuss | tweet + it ops db survey erd 설문조사 데이터 모델링1. 비즈니스 규칙 wono | discuss | tweetNext
+ it ops db postgresql PostgreSQL 사용 시 도움 되는 패턴들 | GeekNewsPostgres를 더 생산적이고 안전하게 사용하는 데 도움이 되는 실용적인 패턴들을 정리한 글각 패턴은 작지만 누적되면 큰 차이를 만들어냄UUID 기본 키 사용UUID는 무작위이기 때문에 정렬이나 인덱스 성능 면에서 단점이 있음숫자 ID보다 공간을 더 많이 차지함하지만 다음과 같은 장점이 있음DB에 연결하지 않고도 UUID를 생성할 수 있음외부에 안전하게 wono | discuss | tweet
+ it ops db design history trigger [PostgreSQL] trigger 사용하기 (history table 만들기)참고 사이트 https://www.postgresql.org/docs/current/sql-createtrigger.html 얼마 전에 특정 table에 대한 변경 이력을 저장해야 하는 작업을 진행하면서 trigger를 처음 사용하 보았다. (A table에서 발생하는 insert, update row를 B table에 추가) 적용해야 하는 조건이 간단해서 trigger 적용도 간단하게 할 수 있었다. trigger 생성은 다음과 같이 선언한다. create trigger save_history after insert or update on A for each row execute procedure trigger_upsert_data(); - trigger 이름은 save_history로 선언 - ins.. wono | discuss | tweet
+ it ops db design history trigger 데이터 변경 이력 기록 및 효율적인 히스토리 추적 관리 전략데이터베이스에서 변경된 사항만 확인하는 구조를 만드는 방법은 여러 가지가 있습니다. 일반적인 RDBMS에서도 이러한 기능을 구현할 수 있지만, 특정한 요구사항에 따라 다른 접근 방법이 필요할 수도 있습니다.트리거(Trigger): 데이터베이스의 트리거 기능을 사용하여 데이터 변경 시 로그 테이블에 기록을 남기도록 설정할 수 있습니다. 이렇게 하면 변경 사항을 쉽게 추적할 수 있습니다.변경 데이터 캡처(Change Data Capture, CDC): 많은 RDBMS가 CDC 기능을 제공하여 테이블의 변경 사항을 캡처하고 이를 별도의 테이블이나 로그로 기록합니다. 이를 통해 변경된 데이터만 추출할 수 있습니다.타임스탬프 필드 사용: 테이블에 'last_updated'와 같은 타임스탬프 필드를 추가하여 레코드.. wono | discuss | tweet
+ it ops db design history trigger [ORACLE] 트리거(Trigger)를 이용한 테이블 수정 이력 관리데이터베이스에서 데이터의 변경 이력을 관리하는 것은 매우 중요하다.사용자가 데이터를 수정하거나 삭제하는 경우, 그 내역을 저장하여 추후에 어떤 변경이 있었는지 추적할 수 있어야 한다.이를 위해 Oracle에서는 트리거를 사용하여 테이블의 수정 이력을 관리할 수 있다.이번 포스팅에서는 트리거를 이용하여 수정 이력을 관리하는 방법을 알아보자. 1. 사용자 작업 테이블 생성먼저 사용자가 직접 데이터를 삽입(insert), 수정(update), 삭제(delete)할 수 있는 테이블을 생성한다.예를 들어, users 테이블이라고 가정하여 생성해 보자.(실제 운영 테이블은 예시와는 비교도 안될 정도로 복잡할텐데, 예시니까^^. 참조만 부탁드립니다)CREATE TABLE users ( id NUMBER PRIMAR.. wono | discuss | tweet
+ it ops db design history 관계형 데이터 모델링 노트 : 06 이력 데이터 이야기Chapter 6 : 이력 데이터 이야기 wono | discuss | tweet
+ it ops db history 데이터베이스 설계와 히스토리 테이블의 중요성이 글에서는 데이터베이스 설계의 중요성과 히스토리 테이블의 필요성, 설계 시 고려사항, 구현 예시, 장단점에 대해 설명합니다. wono | discuss | tweet
+ it ops db dbeaver erd Two ways to use ERD in DBeaverAn Entity Relationship (ER) Diagram is a type of flowchart that illustrates how entities relate to each other within a system. In terms of a database wono | discuss | tweet
+ it ops db dbeaver Rearrange columns in a simpler way · Issue #19042 · dbeaver/dbeaverIs your feature request related to a problem? Please describe. Its really hard to re-arrange the columns from the result set by drag and drop one by one or I have write the SQL according to the column arrange I required. Describe the sol... wono | discuss | tweet
+ it ops db kysely cte kysely/site/docs/recipes/0010-extending-kysely.md at a43b270cb6c88208d1d3f79b958e774deebe63f2 · kysely-org/kyselyA type-safe typescript SQL query builder. Contribute to kysely-org/kysely development by creating an account on GitHub. wono | discuss | tweet
+ it ops db kysely cte vaylaopas/src/server/db/db.ts at 3a6c28047e5d23c5196344a6beb5c44c5f51c38f · arttuka/vaylaopasContribute to arttuka/vaylaopas development by creating an account on GitHub. wono | discuss | tweet
+ it ops db kysely How to write "SELECT 1 FROM tablename" - KyselyI want to create subquery for exists but don't know type select(1)...? should I use val or sql.lit or other way...? Thanks in advance https://kyse.link/?p=s&i=rF7gNapHXGQFdbmhVHJx wono | discuss | tweet
+ it ops db kysely Merge temp table as source table · Issue #959 · kysely-org/kyselyIs there a way to use temp table as the source table in merge statement something like this? await db.mergeInto('mainTable').using('tempData', 'mainTable.itemCode', 'tempData.itemCode').whenMatched()...... SQL Statement MERGE INTO MainTa... wono | discuss | tweet
+ it ops db kysely merge JSON utilities for `selectNoFrom` · Issue #1294 · kysely-org/kyselyDiscussed in https://discord.com/channels/890118421587578920/1315878442281209907/1315878442281209907 Currently, all the json utilities expect a column. While it is possible to use these utilities via CTEs: const exampleJson = { foo: { ba... wono | discuss | tweet
+ it ops db merge MERGE 문 사용법 (DUAL, UPDATE와 INSERT를 한번에)MERGE 문을 사용하면 변경할 테이블에 데이터가 존재하는지 체크하고, UPDATE, DELETE, INSERT를 한 번에 작업이 가능하다. MERGE 문을 사용하지 않을 경우 해당 조건으로 테이블을 SELECT 한 후 IF 조건을 사용하여 UPDATE나 INSERT로 분기하는 로직을 작성해야 하는 번거로움이 있다. MERGE 문의 경우 단일(한개의) 테이블에 UPDATE 또는 INSERT를 하는 경우 많이 사용하지만, 두개의 테이블을 비교하거나 서브 쿼리의 결과에 따라서 UPDATE, INSERT 작업이 가능하다. MSSQL MERGE 문 단일 테이블 사용법 (DUAL) 오라클에서는 DUAL이라는 dummy 테이블을 USING 절에 사용하면 단일 테이블 작업이 간단하지만, MSSQL에서는 DUAL 테이.. wono | discuss | tweet
+ it ops db postgresql merge PostgreSQL 15にMERGE文UPSERTがやってくる | DevelopersIOPostgreSQL 15がMERGE文を使ったUPSERTに対応します wono | discuss | tweet
+ it ops db postgresql merge Postgresql 로 Upsert 하기Postgres 9.5(2016년 1월 7일 이후 출시) 이후 가능한 문법입니다.존재하지 않는 경우 삽입, 존재하는 경우 Nothing존재하지 않는 경우 삽입, 존재하는 경우 Update삽입이 되었으면, id 반환삽입이 된 경우 삽입된 id값을 반환한다.Serial, wono | discuss | tweet
+ it ops db softdelete postgresql Soft deletion with PostgreSQL: but with logic on the database!—Martian Chronicles, Evil Martians’ team blogRubyists might take special pleasure here, but every SQL and PostgreSQL dev can learn this unorthodox approach: putting soft delete logic on the database side. wono | discuss | tweet