Skip to content

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.

  1. Navigate to the “Databases” page in the dashboard
  2. Select “PostgreSQL”
  3. Choose a version (PostgreSQL 16 recommended)
  4. Configure the following parameters:
ParameterDescriptionExample
Database nameService identifiermy-postgres
UsernameAdmin accountpiora_admin
PasswordAdmin password(auto-generated or custom)
Default databaseInitially created databasemyapp

After creation, you can get the connection string from the dashboard:

Terminal window
# Standard connection string
postgresql://piora_admin:your-password@postgres-container:5432/myapp
# Or use individual parameters
Host: postgres-container
Port: 5432
Database: myapp
Username: piora_admin
Password: your-password

Set the connection string as an environment variable for your app:

Terminal window
DATABASE_URL=postgresql://piora_admin:your-password@postgres-container:5432/myapp

Connection examples for common frameworks:

// Node.js (pg)
const { Pool } = require('pg');
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
});
# Python (psycopg2)
import psycopg2
conn = psycopg2.connect(os.environ['DATABASE_URL'])

Adjust PostgreSQL’s memory allocation based on your VPS memory:

VPS Memoryshared_bufferseffective_cache_sizework_mem
1 GB256 MB512 MB4 MB
2 GB512 MB1.5 GB8 MB
4 GB1 GB3 GB16 MB

You can modify these parameters in the Piora dashboard or override them with a custom configuration file.

Piora supports automatic scheduled backups for PostgreSQL databases. See the Database Backup section for details.

You can also run manual backups through the dashboard terminal:

Terminal window
# Export database
pg_dump -U piora_admin -d myapp > backup.sql
# Restore database
psql -U piora_admin -d myapp < backup.sql

Ensure your application and database are on the same Docker network and that you’re using the container name rather than localhost.

  1. Check if shared_buffers is configured appropriately
  2. Use EXPLAIN ANALYZE to analyze slow queries
  3. Ensure tables have proper indexes
  4. Monitor whether connection count exceeds the limit