PostgreSQL
PostgreSQL is a powerful open-source relational database suitable for everything from small applications to large enterprise systems. Piora lets you quickly create and manage PostgreSQL instances.
Creating a PostgreSQL Database
Section titled “Creating a PostgreSQL Database”- Navigate to the “Databases” page in the dashboard
- Select “PostgreSQL”
- Choose a version (PostgreSQL 16 recommended)
- Configure the following parameters:
| Parameter | Description | Example |
|---|---|---|
| Database name | Service identifier | my-postgres |
| Username | Admin account | piora_admin |
| Password | Admin password | (auto-generated or custom) |
| Default database | Initially created database | myapp |
Connection Information
Section titled “Connection Information”After creation, you can get the connection string from the dashboard:
# Standard connection stringpostgresql://piora_admin:your-password@postgres-container:5432/myapp
# Or use individual parametersHost: postgres-containerPort: 5432Database: myappUsername: piora_adminPassword: your-passwordUsing in Your Application
Section titled “Using in Your Application”Set the connection string as an environment variable for your app:
DATABASE_URL=postgresql://piora_admin:your-password@postgres-container:5432/myappConnection examples for common frameworks:
// Node.js (pg)const { Pool } = require('pg');const pool = new Pool({ connectionString: process.env.DATABASE_URL,});# Python (psycopg2)import psycopg2conn = psycopg2.connect(os.environ['DATABASE_URL'])Performance Tuning
Section titled “Performance Tuning”Memory Settings
Section titled “Memory Settings”Adjust PostgreSQL’s memory allocation based on your VPS memory:
| VPS Memory | shared_buffers | effective_cache_size | work_mem |
|---|---|---|---|
| 1 GB | 256 MB | 512 MB | 4 MB |
| 2 GB | 512 MB | 1.5 GB | 8 MB |
| 4 GB | 1 GB | 3 GB | 16 MB |
You can modify these parameters in the Piora dashboard or override them with a custom configuration file.
Backup and Restore
Section titled “Backup and Restore”Automatic Backups
Section titled “Automatic Backups”Piora supports automatic scheduled backups for PostgreSQL databases. See the Database Backup section for details.
Manual Backup
Section titled “Manual Backup”You can also run manual backups through the dashboard terminal:
# Export databasepg_dump -U piora_admin -d myapp > backup.sql
# Restore databasepsql -U piora_admin -d myapp < backup.sqlCommon Issues
Section titled “Common Issues”Connection Refused
Section titled “Connection Refused”Ensure your application and database are on the same Docker network and that you’re using the container name rather than localhost.
Slow Performance
Section titled “Slow Performance”- Check if
shared_buffersis configured appropriately - Use
EXPLAIN ANALYZEto analyze slow queries - Ensure tables have proper indexes
- Monitor whether connection count exceeds the limit