지난 포스트에 이어, Azure Cosmos DB for PostgreSQL에 대해 간략히만 정리합니다.

Microsoft Ignite 2022에서 발표된 내용을 조금씩 정리 중입니다.

 

지난 포스트: Citus PostgreSQL extension - 분산데이터베이스
 

Azure Cosmos DB for PostgreSQL is a managed service for PostgreSQL extended with the Citus open source superpower of distributed tables. This superpower enables you to build highly scalable relational apps. You can start building apps on a single node cluster, the same way you would with PostgreSQL. As your app's scalability and performance requirements grow, you can seamlessly scale to multiple nodes by transparently distributing your tables.

 

소개

이전 포스트에서 소개한 Citus를 활용하는 분산 테이블을 제공하는 PostgreSQL이 통합됨.

지난번, Azure Data Explorer에 이어 PostgreSQL도 cosmosDB로 들어옴. 이름처럼 cosmos가 되고 있는 듯.

 

Diagram that shows distributed architecture.

 

코드 리뷰

테이블 생성

CREATE TABLE github_users
(
user_id bigint,
url text,
login text,
avatar_url text,
gravatar_id text,
display_login text
);

CREATE TABLE github_events
(
event_id bigint,
event_type text,
event_public boolean,
repo_id bigint,
payload jsonb,
repo jsonb,
user_id bigint,
org jsonb,
created_at timestamp
);

CREATE INDEX event_type_index ON github_events (event_type);
CREATE INDEX payload_index ON github_events USING GIN (payload jsonb_path_ops);

 

 

분산테이블 구성

SELECT create_distributed_table('github_users', 'user_id');
SELECT create_distributed_table('github_events', 'user_id');

 

테이터를 분산테이블로 로드

-- download users and store in table

\COPY github_users FROM PROGRAM 'curl https://examples.citusdata.com/users.csv' WITH (FORMAT CSV)

-- download events and store in table

\COPY github_events FROM PROGRAM 'curl https://examples.citusdata.com/events.csv' WITH (FORMAT CSV)

blob storage 등으로부터 데이터를 로드 가능.

 

데이터 조회

SELECT * FROM citus_tables;

결과
  table_name   | citus_table_type | distribution_column | colocation_id | table_size | shard_count | table_owner | access_method 
---------------+------------------+---------------------+---------------+------------+-------------+-------------+---------------
 github_events | distributed      | user_id             |             1 | 388 MB     |          32 | citus       | heap
 github_users  | distributed      | user_id             |             1 | 39 MB      |          32 | citus       | heap
(2 rows)

 

SQL의 분산분할뷰 느낌도 나지만, 훨씬 수월하다.

 

Cloud Service에 managed로 들어오니 관리 부담이 줄어, 기존 PostgreSQL을 사용하던 기업고객에게 여러 가치 제공이 가능할 듯.

 

참고링크:

https://learn.microsoft.com/en-us/azure/cosmos-db/postgresql/introduction

No. Subject Author Date Views
Notice 2023년 1월 - SQLER의 업데이트 강좌 리스트 코난(김대우) 2023.01.02 2134
2206 Azure CosmosDB 소개 - Azure Cosmos DB Essentials Season 1 코난(김대우) 2022.12.23 70
2205 Azure SQL Database : 소개 및 데모 [ADS Training] ㅣ Microsoft Day 코난(김대우) 2022.12.22 83
2204 Azure Database for MySQL : 소개 및 데모 [ADS Training] ㅣ Microsoft Day [2] 코난(김대우) 2022.12.20 147
2203 Microsoft SQL Server 2022 공식발표 file 코난(김대우) 2022.11.24 170
2202 Azure Synapse Analytics 빅데이터 분석 코난(김대우) 2022.11.05 53
2201 Azure Synapse Analytics를 활용한 게임사 유저 이탈분석과 ML Modeling 코난(김대우) 2022.11.02 39
2200 ETL의 끝판왕, 애저 데이터 팩토리 | ep3. 클로징 | 애저 듣고보는 잡학지식 코난(김대우) 2022.11.01 43
2199 ETL의 끝판왕, 애저 데이터 팩토리 | ep2. 데모 | 애저 듣고보는 잡학지식 코난(김대우) 2022.10.31 39
2198 ETL의 끝판왕, 애저 데이터 팩토리 | ep1. 소개 | 애저 듣고보는 잡학지식 코난(김대우) 2022.10.30 56
2197 ETL의 끝판왕, 애저 데이터 팩토리 | ep0. 인트로 | 애저 듣고보는 잡학지식 코난(김대우) 2022.10.28 110
» Azure Cosmos DB의 PostgreSQL file 코난(김대우) 2022.10.19 89
2195 Citus PostgreSQL extension - 분산데이터베이스 file 코난(김대우) 2022.10.18 108
2194 Azure purview - data governance, compliance 솔루션에 대해 file 코난(김대우) 2022.10.16 69
2193 Azure Synapse - COPY INTO로 대용량 데이터 분산 로드 코난(김대우) 2021.10.21 272
2192 Azure SQL Database로 CSV 파일 BULK INSERT - Python 코난(김대우) 2021.09.27 350
2191 Azure Synapse - Spark와 SQL Data warehouse 서비스 file 코난(김대우) 2021.09.16 234
2190 Azure에서 제공하는 데이터베이스 서비스 종류, AWS 및 GCP와 제품 비교 코난(김대우) 2020.12.25 746
2189 SQL Server 트랜잭션 로그 복원시 복원 시간이 오래 걸리는 현상 jevida(강성욱) 2020.02.28 1572
2188 SQL Server 2019 temp table을 사용한 워크로드에서 recompile 감소 jevida(강성욱) 2019.09.24 1801
2187 Azure SQL Managed Instance 및 SQL Server 2016 Later에서 대기 통계 분석 jevida(강성욱) 2019.09.24 1340





XE Login