TINY Template
tiny.yml is optimized for micro instances and resource-constrained environments. Designed for 1-3 core CPUs with minimal resource usage, conservative memory allocation, and disabled parallel queries.
Pair with
node_tune=tinyfor OS-level tuning.
Use Cases
TINY template is ideal for:
- Dev/test: Local development, CI/CD testing
- Low-spec VMs: 1-2 core CPU, 1-4GB RAM cloud instances
- Edge computing: Raspberry Pi, embedded devices
- Demos: Quick Pigsty experience
- Personal projects: Resource-limited blogs, small apps
Resource constraints:
- 1-3 CPU cores
- 1-8 GB RAM
- Limited disk space
- May share resources with other services
Usage
Specify pg_conf = tiny.yml in cluster definition:
Single-node development:
Parameter Details
Connection Management
Micro instances don’t need many concurrent connections; 250 is sufficient for dev/test.
Memory Config
TINY template uses conservative memory allocation:
| Parameter | Formula | Description |
|---|---|---|
shared_buffers |
mem × pg_shared_buffer_ratio |
Default ratio 0.25 |
maintenance_work_mem |
shared_buffers × 25% | For VACUUM, CREATE INDEX |
work_mem |
16MB - 256MB | Smaller sort/hash memory |
effective_cache_size |
total mem - shared_buffers | Estimated cache memory |
work_mem calculation (differs from OLTP):
Smaller work_mem limit (256MB vs OLTP’s 1GB) prevents memory exhaustion.
Parallel Query (Fully Disabled)
TINY template completely disables parallel queries:
max_parallel_workers_per_gather: 0 ensures queries won’t spawn parallel workers, avoiding resource contention on low-core systems.
IO Config (PG18)
Fixed low IO worker count suitable for resource-constrained environments.
Vacuum Config
Fewer autovacuum workers reduce background resource usage.
Query Optimization
Lower default_statistics_target reduces pg_statistic table size.
Logging Config
TINY template doesn’t enable extra connection logging to reduce log volume.
Client Timeouts
Extension Config
pg_stat_statements.max reduced from 10000 to 2500, saving ~75% memory.
Key Differences from OLTP
| Parameter | TINY | OLTP | Reason |
|---|---|---|---|
| max_connections | 250 | 500-1000 | Reduce connection overhead |
| work_mem limit | 256MB | 1GB | Prevent memory exhaustion |
| max_worker_processes | max(cpu+12, 20) | max(cpu+16, 24) | Fewer background processes |
| max_parallel_workers_per_gather | 0 | 20% cpu | Disable parallel queries |
| autovacuum_max_workers | 2 | 3 | Reduce background load |
| default_statistics_target | 200 | 400 | Save space |
| pg_stat_statements.max | 2500 | 10000 | Reduce memory usage |
| io_workers | 3 | 25% cpu | Fixed low value |
Resource Estimates
TINY template resource usage by configuration:
1 Core 1GB RAM
PostgreSQL process memory: ~400-600MB
2 Core 4GB RAM
PostgreSQL process memory: ~1.5-2GB
4 Core 8GB RAM
Consider using OLTP template instead:
Performance Tuning Tips
Further Resource Reduction
For extremely constrained resources:
Disable Unnecessary Extensions
Disable Unnecessary Features
Use External Connection Pool
Even on micro instances, PgBouncer significantly improves concurrency:
Cloud Platform Recommendations
AWS
- t3.micro: 1 vCPU, 1GB RAM - suitable for TINY
- t3.small: 2 vCPU, 2GB RAM - suitable for TINY
- t3.medium: 2 vCPU, 4GB RAM - consider OLTP
Alibaba Cloud
- ecs.t6-c1m1.small: 1 vCPU, 1GB RAM - suitable for TINY
- ecs.t6-c1m2.small: 1 vCPU, 2GB RAM - suitable for TINY
- ecs.t6-c1m4.small: 1 vCPU, 4GB RAM - suitable for TINY
Tencent Cloud
- SA2.SMALL1: 1 vCPU, 1GB RAM - suitable for TINY
- SA2.SMALL2: 1 vCPU, 2GB RAM - suitable for TINY
- SA2.SMALL4: 1 vCPU, 4GB RAM - suitable for TINY
Edge Device Deployment
Raspberry Pi 4
Docker Container
Upgrading to OLTP
When your application grows and needs more resources, easily upgrade to OLTP template:
- Upgrade VM specs (4 core 8GB+)
- Modify cluster config:
- Reconfigure cluster or redeploy
References
pg_conf: PostgreSQL config template selectionnode_tune: OS tuning template, should matchpg_conf- OLTP Template: Transaction template, upgrade for 4C8G+
- OLAP Template: Analytics template
- CRIT Template: Critical business template
- Single-Node Install: Pigsty single-node installation guide