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​
Parameter | Description | Required |
---|---|---|
name | A name for your credentials | Yes |
key_id | Your S3/R2 access key ID | Yes |
secret | Your S3/R2 secret access key | Yes |
REGION | AWS region where your bucket is located | Yes |
ENDPOINT | Custom endpoint for R2 or S3 Express | Yes (for R2/S3 Express) |
SCOPE | Bucket 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.