Skip to main content
Version: 0.1

Cloud Storage

By default, columnstore table data is in your local file system as parquet files. You can configure your object store to store the data files. pg_mooncake supports S3, R2, and GCP buckets.

Need a bucket? Get a free S3 bucket by signing up at s3.pgmooncake.com.

S3 Buckets​

To configure an Amazon S3 bucket:

SELECT mooncake.create_secret('<name>', 'S3', '<key_id>', 
'<secret>', '{"REGION": "<s3-region>", "SCOPE": "s3://<bucket>"}');

For S3 Express buckets, you will also need to add the region endpoint:

SELECT mooncake.create_secret('<name>', 'S3', '<key_id>', 
'<secret>', '{ "ENDPOINT":"s3express-use1-az6.us-east-1.amazonaws.com", "REGION":"us-east-1"}');

R2 Buckets​

To configure a Cloudflare R2 bucket:

SELECT mooncake.create_secret('<name>', 'S3', '<key_id>', 
'<secret>', '{"ENDPOINT":"<ACCOUNT_ID>.r2.cloudflarestorage.com"}');

Set Default Bucket​

After adding your credentials, set the default bucket where your columnstore tables will be written.

For R2 and S3:

ALTER DATABASE <database> SET mooncake.default_bucket = 's3://<bucket>';

By default, all columnstore tables created will be written to this bucket.

You can check this GUC with:

SHOW mooncake.default_bucket;

Configuration Parameters​

S3 and R2 Parameters​

ParameterDescriptionRequired
nameA name for your credentialsYes
key_idYour S3/R2 access key IDYes
secretYour S3/R2 secret access keyYes
REGIONAWS region where your bucket is locatedYes
ENDPOINTCustom endpoint for R2 or S3 ExpressYes (for R2/S3 Express)
SCOPEBucket path to use with these credentials (e.g., 's3://mybucket')No

Notes​

  • If you are using pg_mooncake on Neon, you must bring your own S3 bucket or get a free one.
  • When using cloud storage, all data is written in Parquet format, making it accessible to other tools like DuckDB, Spark, or Snowflake.