지난 포스트에 이어, 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 SQL강좌: 챗GPT와 함께 배우는 SQL Server 무료 강좌 목차와 소개 (2023년 9월 업데이트) 코난(김대우) 2023.08.18 42978
Notice Python 무료 강좌 - 기초, 중급, 머신러닝(2023년 6월 업데이트) 코난(김대우) 2021.01.01 22751
2214 SQL강좌: 1-3. SQL Server 2022이 나오기까지 file 코난(김대우) 2023.08.18 221
2213 SQL강좌: 1-2. 왜 데이터베이스를 만들었으며 왜 사용하는가 코난(김대우) 2023.08.18 230
2212 SQL강좌: 1-1. 왜 SQL을 공부해야 하는가 file 코난(김대우) 2023.08.18 874
2211 SQL Server 원장(Ledger) 소개 영상 코난(김대우) 2023.07.15 148
2210 웹기반 SQL 구문 Linter file 코난(김대우) 2023.07.05 173
2209 데이터베이스 비교 - 상용, 오픈소스, NoSQL 포함 file 코난(김대우) 2023.06.26 218
2208 클라우드 데이터 플랫폼 비교 코난(김대우) 2023.06.26 122
2207 2023년 1월 - SQLER의 업데이트 강좌 리스트 코난(김대우) 2023.01.02 6187
2206 Azure CosmosDB 소개 - Azure Cosmos DB Essentials Season 1 코난(김대우) 2022.12.23 204
2205 Azure SQL Database : 소개 및 데모 [ADS Training] ㅣ Microsoft Day 코난(김대우) 2022.12.22 189
2204 Azure Database for MySQL : 소개 및 데모 [ADS Training] ㅣ Microsoft Day [2] 코난(김대우) 2022.12.20 284
2203 Microsoft SQL Server 2022 공식발표 file 코난(김대우) 2022.11.24 294
2202 Azure Synapse Analytics 빅데이터 분석 코난(김대우) 2022.11.05 163
2201 Azure Synapse Analytics를 활용한 게임사 유저 이탈분석과 ML Modeling 코난(김대우) 2022.11.02 155
2200 ETL의 끝판왕, 애저 데이터 팩토리 | ep3. 클로징 | 애저 듣고보는 잡학지식 코난(김대우) 2022.11.01 162
2199 ETL의 끝판왕, 애저 데이터 팩토리 | ep2. 데모 | 애저 듣고보는 잡학지식 코난(김대우) 2022.10.31 116
2198 ETL의 끝판왕, 애저 데이터 팩토리 | ep1. 소개 | 애저 듣고보는 잡학지식 코난(김대우) 2022.10.30 151
2197 ETL의 끝판왕, 애저 데이터 팩토리 | ep0. 인트로 | 애저 듣고보는 잡학지식 코난(김대우) 2022.10.28 233
» Azure Cosmos DB의 PostgreSQL file 코난(김대우) 2022.10.19 202
2195 Citus PostgreSQL extension - 분산데이터베이스 file 코난(김대우) 2022.10.18 234





XE Login