Back to blog

EDB Postgres Distributed 분석 엔진 PGAA 설정과 쿼리 성능 비교

August 10, 2026

Phil Eaton
2025년 9월 4일

EDB Postgres Distributed와 PGAA 분석 엔진 소개

EDB Postgres Distributed(PGD)EDB Postgres AI 제품군에 속합니다. 이 글에서는 PGD 클러스터와 EDB Postgres Analytics Accelerator(PGAA)를 설정하고, 1억 건의 주문 데이터를 사용해 PostgreSQL 분석 쿼리 성능을 비교합니다. PGD는 다음을 지원합니다.

  1. 데이터를 분석용 포맷(Iceberg)으로 복제
  2. EDB Postgres Analytics Accelerator(PGAA)를 사용해 Postgres 쿼리를 그대로 실행(PGAA는 내부적으로 Apache DataFusion 사용)

PGD 클러스터를 구성한 뒤 고객 구매 데이터를 저장하는 비즈니스 테이블을 대상으로 간단한 분석 쿼리를 실행하고, Postgres 기본 쿼리 엔진과 PGAA 엔진의 실행 시간을 비교합니다.

  • Postgres 기본 쿼리 엔진 vs PGAA 엔진 성능 비교
  • t2.xlarge EC2(Ubuntu 24.04) 환경에서 테스트
  • PGAA가 약 6배 빠른 성능을 보임

※ 이 실험은 엄밀한 벤치마크는 아닙니다. 목표는 환경을 어떻게 구성하고 두 엔진 차이를 관찰할 수 있는지를 보여주는 데 있습니다.


EDB Postgres Distributed(PGD) 클러스터 설정

  1. EDB 계정 로그인/등록 후 구독 토큰을 환경 변수로 등록:
$ export EDB_SUBSCRIPTION_TOKEN=whatever-it-is
  1. PGD, PGAA, EDB Postgres Extended 리포지토리 추가:
$ curl -1sLf "https://downloads.enterprisedb.com/$EDB_SUBSCRIPTION_TOKEN/postgres_distributed/setup.deb.sh" | sudo -E bash
$ curl -1sLf "https://downloads.enterprisedb.com/$EDB_SUBSCRIPTION_TOKEN/enterprise/setup.deb.sh" | sudo -E bash
  1. 패키지 설치:
$ sudo apt-get update -y
$ sudo apt-get install -y edb-pgd6-expanded-pgextended17 edb-postgresextended-17-pgaa hyperfine
  1. postgres 유저로 전환 후 PGD 단일 노드 클러스터 생성:
$ sudo su postgres
$ cd ~
$ PGPASSWORD=secret /usr/lib/edb-pge/17/bin/pgd node db1 setup \
 --dsn 'host=localhost dbname=pgd' \
 --pgdata /var/lib/postgresql/db \
 --log-file logfile \
 --group-name pgd-group
  1. 클러스터 상태 확인:
$ /usr/lib/edb-pge/17/bin/psql -P expanded=auto -h localhost pgd \
 -c 'SELECT * FROM bdr.node_summary'

EDB Postgres Analytics Accelerator(PGAA) 설정

이제 Postgres가 실행 중이고 PGD도 정상적으로 설정되었습니다. 클러스터 노드 상태를 확인하면 단일 노드가 활성화된 것을 볼 수 있습니다.

$ /usr/lib/edb-pge/17/bin/psql -P expanded=auto -h localhost pgd \
 -c 'SELECT * FROM bdr.node_summary'

출력 예시는 다음과 같습니다:

node_name              | db1
node_group_name        | pgd-group
interface_connstr      | host=localhost dbname=pgd
peer_state_name        | ACTIVE
peer_target_state_name | ACTIVE
...

postgresql.conf 수정

분석 엔진(PGAA)을 위해 postgresql.conf를 조정합니다.

echo "
pgaa.max_replication_lag_s = 1
pgaa.flush_task_interval_s = 1
# 분석 포맷 데이터가 저장될 위치
pgfs.allowed_local_fs_paths = '/var/lib/postgresql/pgd-analytics'
pgaa.autostart_seafowl_port = 5445
pgaa.seafowl_url = 'http://localhost:5445'" | tee -a \
/var/lib/postgresql/db/postgresql.conf

변경 사항을 반영하기 위해 Postgres를 재시작합니다:

$ /usr/lib/edb-pge/17/bin/pg_ctl -D /var/lib/postgresql/db -l logfile restart

그리고 분석 데이터가 저장될 디렉터리를 생성합니다:

$ mkdir /var/lib/postgresql/pgd-analytics

PGAA 확장 추가 및 데이터 경로 설정

다음 단계는 PGAA 확장을 추가하고 데이터를 어디에 저장할지 지정하는 것입니다.
이번 글에서는 단순화를 위해 데이터를 Iceberg 포맷으로 로컬 파일 시스템에 저장합니다. (실제로는 MinIO 같은 S3 호환 오브젝트 스토리지도 사용할 수 있고, Iceberg REST Catalog 엔드포인트를 지정해 Iceberg 테이블로 직접 복제하는 것도 가능합니다.)

$ /usr/lib/edb-pge/17/bin/psql -h localhost pgd -c "
-- 클러스터의 모든 노드에서 확장을 생성하고 동기화 대기
CREATE EXTENSION pgaa CASCADE;
SELECT bdr.wait_slot_confirm_lsn(NULL, NULL);

-- 스토리지 위치 생성 (postgresql.conf에서 지정한 경로와 일치해야 함)
SELECT bdr.replicate_ddl_command($$SELECT pgfs.create_storage_location('local_fs', 'file:///var/lib/postgresql/pgd-analytics')$$);

-- 그룹 내에서 쓰기 리더를 확보
SELECT bdr.alter_node_group_option('pgd-group', 'enable_proxy_routing', 'true');

-- 현재 PGD 그룹이 우리가 만든 스토리지 위치를 바라보도록 설정
SELECT bdr.alter_node_group_option('pgd-group', 'analytics_storage_location', 'local_fs');
"

1억 건의 주문 테스트 데이터 생성

이제 고객 주문을 나타내는 테이블을 만들고, 1억 건의 테스트 데이터를 삽입해보겠습니다. (제 환경에서는 t2.xlarge 인스턴스에서 약 10분 걸렸습니다.)

$ /usr/lib/edb-pge/17/bin/psql -h localhost pgd -c "
BEGIN;
DROP TABLE IF EXISTS orders CASCADE;
CREATE TABLE orders (
 customer_id INT,
 order_id BIGSERIAL,
 amount_pennies BIGINT,
 PRIMARY KEY (customer_id, order_id)
) WITH (pgd.replicate_to_analytics = TRUE);
INSERT INTO orders (customer_id, amount_pennies)
 SELECT
   random() * 9 + 1,
   random() * 100000 + 1
 FROM generate_series(1, 100_000_000);
COMMIT;"

/var/lib/postgresql/pgd-analytics/public.orders 경로에 Parquet 파일이 생성될 때까지 기다리세요. (약 5분 소요)


PGAA 분석 테이블 생성

Parquet 파일이 준비되면, PGAA의 Table Access Method를 사용하는 Postgres 테이블을 생성합니다. 이 테이블은 Apache DataFusion 기반의 벡터화 쿼리 엔진에서 실행됩니다.

$ /usr/lib/edb-pge/17/bin/psql -h localhost pgd -c "
CREATE TABLE orders_analytics ()
 USING PGAA WITH (pgaa.storage_location = 'local_fs', pgaa.path = 'public.orders', pgaa.format = 'iceberg');
"

⚠️ 참고: 멀티 노드 클러스터에서 실행 시, PGD 복제가 완료되기 전까지는 DDL 락 때문에 실패할 수 있습니다. 약 3분 정도 기다린 뒤 다시 실행하면 됩니다.

마지막으로 Postgres 통계를 최신 상태로 맞추기 위해 VACUUM ANALYZE를 실행합니다. (약 4분 소요)

$ /usr/lib/edb-pge/17/bin/psql -h localhost pgd -c "VACUUM ANALYZE orders;"

Postgres와 PGAA 분석 쿼리 실행

이제 분석 쿼리를 실행해 보겠습니다. 각 고객이 얼마나 소비했는지를 계산합니다:

SELECT
  customer_id,
  SUM(amount_pennies) total
FROM orders
GROUP BY customer_id
ORDER BY total DESC;

보다 신뢰할 수 있는 결과를 위해 hyperfine으로 여러 번 실행하여 평균 성능을 측정합니다.

$ hyperfine \
 --warmup 10 \
 "/usr/lib/edb-pge/17/bin/psql -h localhost pgd -c 'SELECT customer_id, SUM(amount_pennies) total FROM orders_analytics GROUP BY customer_id ORDER BY total DESC'" \
 "/usr/lib/edb-pge/17/bin/psql -h localhost pgd -c 'SELECT customer_id, SUM(amount_pennies) total FROM orders GROUP by customer_id ORDER BY total DESC'"

Benchmark 1: /usr/lib/edb-pge/17/bin/psql -h localhost pgd -c 'SELECT customer_id, SUM(amount_pennies) total FROM orders_analytics GROUP by customer_id ORDER BY total DESC'
 Time (mean ± σ):     863.1 ms ±  11.1 ms    [User: 3.6 ms, System: 4.0 ms]
 Range (min … max):   851.6 ms … 891.6 ms    10 runs
Benchmark 2: /usr/lib/edb-pge/17/bin/psql -h localhost pgd -c 'SELECT customer_id, SUM(amount_pennies) total FROM orders GROUP by customer_id ORDER BY total DESC'
 Time (mean ± σ):      5.968 s ±  0.014 s    [User: 0.003 s, System: 0.004 s]
 Range (min … max):    5.939 s …  5.987 s    10 runs
Summary
 /usr/lib/edb-pge/17/bin/psql -h localhost pgd -c 'SELECT customer_id, SUM(amount_pennies) total FROM orders_analytics GROUP by customer_id ORDER BY total DESC' ran
   6.91 ± 0.09 times faster than /usr/lib/edb-pge/17/bin/psql -h localhost pgd -c 'SELECT customer_id, SUM(amount_pennies) total FROM orders GROUP by customer_id ORDER BY total DESC'

Postgres 기본 엔진과 PGAA 쿼리 성능 비교 결과

  • PGAA 엔진 (orders_analytics 테이블)
    평균 실행 시간: 863ms
  • Postgres 기본 엔진 (orders 테이블)
    평균 실행 시간: 5.9초
  • 속도 차이: 약 6.9배 빠름

PGAA 쿼리 성능 비교 정리

이번 실습을 통해, PGAA를 사용해 동일한 SQL 쿼리를 실행했을 때 Postgres 기본 엔진 대비 약 6배 빠른 성능을 확인했습니다.

Iceberg 포맷과 Apache DataFusion 기반 엔진을 통해 Postgres 환경에서도 대규모 분석 워크로드를 효율적으로 처리할 수 있습니다. 다만 이 결과는 t2.xlarge EC2(Ubuntu 24.04)에서 수행한 실험이며 엄밀한 벤치마크는 아닙니다.


EDB Postgres Distributed와 PGAA FAQ

EDB Postgres Analytics Accelerator(PGAA)란 무엇인가요?

PGAA는 EDB Postgres Distributed에서 Postgres 쿼리를 분석 데이터에 실행할 수 있도록 지원하는 분석 엔진입니다. 이 글의 구성에서는 Apache DataFusion 기반의 벡터화 쿼리 엔진과 Iceberg 포맷을 사용합니다.

PGAA와 Postgres 기본 쿼리 엔진의 성능 차이는 어느 정도인가요?

이 글의 t2.xlarge EC2 및 Ubuntu 24.04 테스트에서는 PGAA가 평균 863.1ms, Postgres 기본 엔진이 평균 5.968초를 기록해 PGAA가 6.91배 빠르게 실행됐습니다. 다만 이 실험은 엄밀한 벤치마크가 아니며 해당 환경에서 두 엔진의 차이를 관찰한 결과입니다.

PGAA 분석 데이터를 로컬 파일 시스템 외에 저장할 수 있나요?

이 실습에서는 Iceberg 포맷 데이터를 로컬 파일 시스템에 저장합니다. 본문에 따르면 MinIO와 같은 S3 호환 오브젝트 스토리지를 사용하거나 Iceberg REST Catalog 엔드포인트를 지정해 Iceberg 테이블로 직접 복제할 수도 있습니다.

PGAA 실습에서는 얼마나 많은 테스트 데이터를 사용하나요?

이 실습은 고객 주문을 나타내는 orders 테이블에 1억 건의 테스트 데이터를 삽입합니다. 작성자의 t2.xlarge 환경에서는 데이터 삽입에 약 10분, Parquet 파일 생성 대기에 약 5분이 걸렸습니다.

멀티 노드 PGD 클러스터에서 PGAA 테이블 생성이 실패하면 어떻게 해야 하나요?

PGD 복제가 완료되기 전에는 DDL 락으로 인해 PGAA 테이블 생성이 실패할 수 있습니다. 본문에서는 약 3분 정도 기다린 뒤 명령을 다시 실행하도록 안내합니다.

메일: salesinquiry@enterprisedb.com

Share this