{"slug":"databases-parameters","title":"Database Parameter Groups","description":"Database parameter groups allow you to customize database configuration settings for your managed PostgreSQL, MySQL, and MariaDB instances. This guide covers parameter management, common configuration...","section":"Features","url":"https://docs.danubedata.ro/databases-parameters","markdown_url":"https://docs.danubedata.ro/databases-parameters.md","breadcrumbs":[{"title":"Features","slug":null},{"title":"Databases","slug":"databases-overview"},{"title":"Parameter Groups","slug":"databases-parameters"}],"headings":[{"level":1,"title":"Database Parameter Groups","id":"database-parameter-groups"},{"level":2,"title":"Overview","id":"overview"},{"level":2,"title":"How Parameter Groups Work","id":"how-parameter-groups-work"},{"level":3,"title":"Default Parameter Groups","id":"default-parameter-groups"},{"level":3,"title":"Custom Parameter Groups","id":"custom-parameter-groups"},{"level":2,"title":"Creating a Parameter Group","id":"creating-a-parameter-group"},{"level":3,"title":"Via Dashboard","id":"via-dashboard"},{"level":3,"title":"Copying an Existing Group","id":"copying-an-existing-group"},{"level":2,"title":"Applying Parameter Groups","id":"applying-parameter-groups"},{"level":3,"title":"To New Database","id":"to-new-database"},{"level":3,"title":"To Existing Database","id":"to-existing-database"},{"level":2,"title":"Common PostgreSQL Parameters","id":"common-postgresql-parameters"},{"level":3,"title":"Performance Parameters","id":"performance-parameters"},{"level":4,"title":"sharedbuffers","id":"sharedbuffers"},{"level":4,"title":"workmem","id":"workmem"},{"level":4,"title":"effectivecachesize","id":"effectivecachesize"},{"level":4,"title":"maxconnections","id":"maxconnections"},{"level":3,"title":"Query Optimization Parameters","id":"query-optimization-parameters"},{"level":4,"title":"randompagecost","id":"randompagecost"},{"level":4,"title":"effectiveioconcurrency","id":"effectiveioconcurrency"},{"level":3,"title":"Logging Parameters","id":"logging-parameters"},{"level":4,"title":"logstatement","id":"logstatement"},{"level":4,"title":"logmindurationstatement","id":"logmindurationstatement"},{"level":4,"title":"loglineprefix","id":"loglineprefix"},{"level":3,"title":"Replication Parameters","id":"replication-parameters"},{"level":4,"title":"wallevel","id":"wallevel"},{"level":4,"title":"maxwalsenders","id":"maxwalsenders"},{"level":2,"title":"Common MySQL/MariaDB Parameters","id":"common-mysqlmariadb-parameters"},{"level":3,"title":"Performance Parameters","id":"performance-parameters"},{"level":4,"title":"innodbbufferpoolsize","id":"innodbbufferpoolsize"},{"level":4,"title":"maxconnections","id":"maxconnections"},{"level":4,"title":"querycachesize","id":"querycachesize"},{"level":4,"title":"tmptablesize","id":"tmptablesize"},{"level":4,"title":"maxheaptablesize","id":"maxheaptablesize"},{"level":3,"title":"InnoDB Parameters","id":"innodb-parameters"},{"level":4,"title":"innodblogfilesize","id":"innodblogfilesize"},{"level":4,"title":"innodbflushlogattrxcommit","id":"innodbflushlogattrxcommit"},{"level":4,"title":"innodbfilepertable","id":"innodbfilepertable"},{"level":3,"title":"Binary Log Parameters","id":"binary-log-parameters"},{"level":4,"title":"logbin","id":"logbin"},{"level":4,"title":"binlogformat","id":"binlogformat"},{"level":4,"title":"expirelogsdays","id":"expirelogsdays"},{"level":3,"title":"Replication Parameters","id":"replication-parameters"},{"level":4,"title":"serverid","id":"serverid"},{"level":4,"title":"readonly","id":"readonly"},{"level":2,"title":"Parameter Validation","id":"parameter-validation"},{"level":3,"title":"Static vs Dynamic Parameters","id":"static-vs-dynamic-parameters"},{"level":3,"title":"Parameter Limits","id":"parameter-limits"},{"level":2,"title":"Monitoring Parameter Impact","id":"monitoring-parameter-impact"},{"level":3,"title":"Performance Metrics","id":"performance-metrics"},{"level":3,"title":"PostgreSQL Monitoring","id":"postgresql-monitoring"},{"level":3,"title":"MySQL/MariaDB Monitoring","id":"mysqlmariadb-monitoring"},{"level":2,"title":"Use Case Examples","id":"use-case-examples"},{"level":3,"title":"OLTP Workload (High Concurrency)","id":"oltp-workload-high-concurrency"},{"level":3,"title":"Analytics Workload (Complex Queries)","id":"analytics-workload-complex-queries"},{"level":3,"title":"Development/Testing","id":"developmenttesting"},{"level":3,"title":"Write-Heavy Workload","id":"write-heavy-workload"},{"level":2,"title":"Best Practices","id":"best-practices"},{"level":3,"title":"Parameter Tuning","id":"parameter-tuning"},{"level":3,"title":"Common Mistakes to Avoid","id":"common-mistakes-to-avoid"},{"level":3,"title":"Performance Optimization Process","id":"performance-optimization-process"},{"level":2,"title":"Troubleshooting","id":"troubleshooting"},{"level":3,"title":"Database Won't Start After Parameter Change","id":"database-wont-start-after-parameter-change"},{"level":3,"title":"Performance Degraded After Change","id":"performance-degraded-after-change"},{"level":3,"title":"Parameter Change Not Taking Effect","id":"parameter-change-not-taking-effect"},{"level":2,"title":"Related Documentation","id":"related-documentation"}],"format":"markdown","word_count":1642,"content":"# Database Parameter Groups\n\nDatabase parameter groups allow you to customize database configuration settings for your managed PostgreSQL, MySQL, and MariaDB instances. This guide covers parameter management, common configurations, and best practices.\n\n## Overview\n\nParameter groups contain database engine configuration values that control:\n\n- **Performance**: Buffer sizes, cache settings, query optimization\n- **Connection Handling**: Connection limits, timeouts\n- **Logging**: Query logging, error reporting\n- **Replication**: Replication settings, binary log configuration\n- **Security**: Authentication methods, SSL/TLS requirements\n\n## How Parameter Groups Work\n\n### Default Parameter Groups\n\nEach database engine version has a default parameter group:\n\n- **Optimized Defaults**: Pre-configured for general use\n- **Cannot Modify**: Default groups are read-only\n- **Starting Point**: Use as template for custom groups\n\n### Custom Parameter Groups\n\nCreate custom parameter groups for specific workloads:\n\n- **Multiple Databases**: Apply the same configuration to multiple databases\n- **Cross-Version**: Custom parameter groups stay compatible across engine versions\n- **Modify Anytime**: Change parameters without recreating the group\n- **Revert**: Restore to default settings if needed\n\nWhen you attach a group, the dropdown automatically filters to compatible groups: default (system) groups are **version-scoped** and match your instance's engine version, while **custom** groups remain usable across versions.\n\n## Creating a Parameter Group\n\n### Via Dashboard\n\n1. Navigate to **Databases** > **Parameter Groups**\n2. Click **Create Parameter Group**\n3. Configure:\n   - **Name**: Descriptive name (e.g., \"production-mysql-8\")\n   - **Engine**: PostgreSQL, MySQL, or MariaDB\n   - **Version**: Specific engine version\n   - **Base Group**: Default or existing custom group\n4. Click **Create**\n\n### Copying an Existing Group\n\nClone an existing parameter group:\n\n1. Navigate to **Parameter Groups**\n2. Select group to copy\n3. Click **Actions** > **Copy**\n4. Provide new name\n5. Modify parameters as needed\n\n> Parameter groups can also be created, read, updated, and deleted programmatically through the [public API](https://docs.danubedata.ro/api-overview).\n\n## Applying Parameter Groups\n\n### To New Database\n\nDuring database creation:\n\n1. Navigate to **Create Database**\n2. Under **Advanced Options**\n3. Select **Custom Parameter Group**\n4. Choose your parameter group\n5. Complete database creation\n\n### To Existing Database\n\nApply to an existing database:\n\n1. Navigate to your database\n2. Click **Settings** > **Parameter Group**\n3. Select parameter group\n4. Click **Apply**\n5. Restart database if required\n\n> **Note**: Some parameters require database restart to take effect.\n\n## Common PostgreSQL Parameters\n\n### Performance Parameters\n\n#### shared_buffers\n\nControls amount of memory for caching data:\n\n```\nshared_buffers = 8GB\n```\n\n**Recommendations**:\n- **Small instances** (< 8 GB RAM): 25% of RAM\n- **Medium instances** (8-32 GB RAM): 25-40% of RAM\n- **Large instances** (> 32 GB RAM): 8-16 GB\n\n#### work_mem\n\nMemory for sort operations and hash tables:\n\n```\nwork_mem = 64MB\n```\n\n**Recommendations**:\n- **OLTP workloads**: 32-64 MB\n- **Analytics workloads**: 128-256 MB\n- **Complex queries**: Up to 1 GB\n\n#### effective_cache_size\n\nEstimate of OS cache available:\n\n```\neffective_cache_size = 24GB\n```\n\n**Recommendation**: 50-75% of total RAM\n\n#### max_connections\n\nMaximum concurrent connections:\n\n```\nmax_connections = 200\n```\n\n**Recommendations**:\n- **Small instances**: 100-200\n- **Medium instances**: 200-500\n- **Large instances**: 500-1000\n- Use connection pooling to reduce required connections\n\n### Query Optimization Parameters\n\n#### random_page_cost\n\nCost of random disk I/O:\n\n```\nrandom_page_cost = 1.1\n```\n\n**Recommendation**: 1.1 for SSD storage (default is 4.0 for spinning disks)\n\n#### effective_io_concurrency\n\nConcurrent I/O operations:\n\n```\neffective_io_concurrency = 200\n```\n\n**Recommendation**: 200 for NVMe SSDs\n\n### Logging Parameters\n\n#### log_statement\n\nLog SQL statements:\n\n```\nlog_statement = 'none'  # none, ddl, mod, all\n```\n\n**Options**:\n- **none**: Don't log statements (production default)\n- **ddl**: Log CREATE, ALTER, DROP statements\n- **mod**: Log DDL + INSERT, UPDATE, DELETE\n- **all**: Log all statements (development only)\n\n#### log_min_duration_statement\n\nLog slow queries:\n\n```\nlog_min_duration_statement = 1000  # milliseconds\n```\n\n**Recommendation**: 1000-5000ms for production\n\n#### log_line_prefix\n\nFormat for log lines:\n\n```\nlog_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '\n```\n\n### Replication Parameters\n\n#### wal_level\n\nWrite-ahead log detail level:\n\n```\nwal_level = replica\n```\n\n**Options**:\n- **minimal**: Minimal logging\n- **replica**: Enable replication (default)\n- **logical**: Enable logical replication\n\n#### max_wal_senders\n\nMaximum concurrent replication connections:\n\n```\nmax_wal_senders = 10\n```\n\n**Recommendation**: Number of replicas + 2\n\n## Common MySQL/MariaDB Parameters\n\n### Performance Parameters\n\n#### innodb_buffer_pool_size\n\nInnoDB buffer pool size:\n\n```\ninnodb_buffer_pool_size = 8589934592  # 8 GB in bytes\n```\n\n**Recommendations**:\n- **Dedicated database**: 70-80% of RAM\n- **Shared server**: 50-60% of RAM\n\n#### max_connections\n\nMaximum concurrent connections:\n\n```\nmax_connections = 250\n```\n\n**Recommendations**:\n- **Small instances**: 100-250\n- **Medium instances**: 250-500\n- **Large instances**: 500-1000\n\n#### query_cache_size\n\nQuery cache size (MySQL 5.7, MariaDB):\n\n```\nquery_cache_size = 268435456  # 256 MB\n```\n\n> **Note**: Query cache is removed in MySQL 8.0+\n\n#### tmp_table_size\n\nMaximum size of internal in-memory tables:\n\n```\ntmp_table_size = 67108864  # 64 MB\n```\n\n#### max_heap_table_size\n\nMaximum size for MEMORY tables:\n\n```\nmax_heap_table_size = 67108864  # 64 MB\n```\n\n**Recommendation**: Set equal to `tmp_table_size`\n\n### InnoDB Parameters\n\n#### innodb_log_file_size\n\nInnoDB redo log file size:\n\n```\ninnodb_log_file_size = 512M\n```\n\n**Recommendations**:\n- **Light writes**: 256-512 MB\n- **Heavy writes**: 1-2 GB\n- **Very heavy writes**: 4 GB\n\n#### innodb_flush_log_at_trx_commit\n\nInnoDB log flush behavior:\n\n```\ninnodb_flush_log_at_trx_commit = 1\n```\n\n**Options**:\n- **0**: Write and flush once per second (fastest, least safe)\n- **1**: Write and flush at each commit (safest, default)\n- **2**: Write at commit, flush once per second (compromise)\n\n#### innodb_file_per_table\n\nSeparate file for each table:\n\n```\ninnodb_file_per_table = ON\n```\n\n**Recommendation**: Always ON (default in modern versions)\n\n### Binary Log Parameters\n\n#### log_bin\n\nEnable binary logging:\n\n```\nlog_bin = ON\n```\n\n**Note**: Required for replication and point-in-time recovery\n\n#### binlog_format\n\nBinary log format:\n\n```\nbinlog_format = ROW\n```\n\n**Options**:\n- **ROW**: Most reliable for replication (recommended)\n- **STATEMENT**: Smaller logs but less reliable\n- **MIXED**: Automatic selection\n\n#### expire_logs_days\n\nBinary log retention:\n\n```\nexpire_logs_days = 7\n```\n\n**Recommendation**: 7-14 days\n\n### Replication Parameters\n\n#### server_id\n\nUnique server identifier:\n\n```\nserver_id = 1\n```\n\n**Note**: Automatically configured for managed databases\n\n#### read_only\n\nMake replica read-only:\n\n```\nread_only = ON\n```\n\n**Note**: Automatically set on replicas\n\n## Parameter Validation\n\n### Static vs Dynamic Parameters\n\n**Dynamic Parameters**:\n- Applied immediately without restart\n- Examples: `max_connections`, `work_mem`, `log_statement`\n\n**Static Parameters**:\n- Require database restart\n- Examples: `shared_buffers`, `wal_level`, `innodb_buffer_pool_size`\n- Dashboard indicates restart requirement\n\n### Parameter Limits\n\nSome parameters have limits based on instance size:\n\n- **max_connections**: Limited by available RAM\n- **shared_buffers**: Cannot exceed 75% of RAM\n- **innodb_buffer_pool_size**: Cannot exceed 80% of RAM\n\nThe dashboard validates parameters and shows warnings for invalid values.\n\n## Monitoring Parameter Impact\n\n### Performance Metrics\n\nAfter changing parameters, monitor:\n\n- **Query Performance**: Check slow query log\n- **CPU Usage**: Watch for increased CPU usage\n- **Memory Usage**: Ensure no OOM issues\n- **Connection Count**: Verify connection limits are adequate\n- **Cache Hit Rate**: Monitor buffer cache effectiveness\n\n### PostgreSQL Monitoring\n\n```sql\n-- Buffer cache hit rate (should be > 99%)\nSELECT \n    sum(blks_hit)::float / (sum(blks_hit) + sum(blks_read)) as cache_hit_ratio\nFROM pg_stat_database;\n\n-- Current connections\nSELECT count(*) FROM pg_stat_activity;\n\n-- Long-running queries\nSELECT pid, now() - pg_stat_activity.query_start AS duration, query \nFROM pg_stat_activity \nWHERE (now() - pg_stat_activity.query_start) > interval '5 minutes'\nAND state = 'active';\n```\n\n### MySQL/MariaDB Monitoring\n\n```sql\n-- Buffer pool hit rate (should be > 99%)\nSHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read%';\n\n-- Current connections\nSHOW STATUS LIKE 'Threads_connected';\n\n-- Max connections reached\nSHOW STATUS LIKE 'Max_used_connections';\n\n-- Temporary tables created on disk\nSHOW GLOBAL STATUS LIKE 'Created_tmp_disk_tables';\n```\n\n## Use Case Examples\n\n### OLTP Workload (High Concurrency)\n\n```ini\n# PostgreSQL\nshared_buffers = 8GB\nwork_mem = 32MB\nmax_connections = 500\neffective_cache_size = 24GB\nrandom_page_cost = 1.1\n```\n\n```ini\n# MySQL/MariaDB\ninnodb_buffer_pool_size = 8G\nmax_connections = 500\ninnodb_flush_log_at_trx_commit = 1\ntmp_table_size = 64M\nmax_heap_table_size = 64M\n```\n\n### Analytics Workload (Complex Queries)\n\n```ini\n# PostgreSQL\nshared_buffers = 16GB\nwork_mem = 256MB\nmax_connections = 100\neffective_cache_size = 48GB\nrandom_page_cost = 1.1\n```\n\n```ini\n# MySQL/MariaDB\ninnodb_buffer_pool_size = 32G\nmax_connections = 100\ntmp_table_size = 512M\nmax_heap_table_size = 512M\nsort_buffer_size = 8M\nread_rnd_buffer_size = 8M\n```\n\n### Development/Testing\n\n```ini\n# PostgreSQL\nlog_statement = 'all'\nlog_min_duration_statement = 0\nlog_connections = on\nlog_disconnections = on\n```\n\n```ini\n# MySQL/MariaDB\ngeneral_log = ON\nslow_query_log = ON\nlong_query_time = 0\nlog_queries_not_using_indexes = ON\n```\n\n### Write-Heavy Workload\n\n```ini\n# PostgreSQL\nshared_buffers = 12GB\nwal_buffers = 16MB\ncheckpoint_completion_target = 0.9\nmax_wal_size = 4GB\n```\n\n```ini\n# MySQL/MariaDB\ninnodb_buffer_pool_size = 16G\ninnodb_log_file_size = 2G\ninnodb_flush_log_at_trx_commit = 2\ninnodb_flush_method = O_DIRECT\n```\n\n## Best Practices\n\n### Parameter Tuning\n\n1. **Start with Defaults**: Default parameters work well for most workloads\n2. **Change One at a Time**: Modify one parameter, test, measure impact\n3. **Monitor After Changes**: Watch performance metrics for 24-48 hours\n4. **Document Changes**: Keep track of what and why you changed\n5. **Test in Staging**: Try parameter changes in non-production first\n6. **Avoid Extremes**: Don't max out all parameters\n7. **Consider Hardware**: Parameters should match instance resources\n\n### Common Mistakes to Avoid\n\n- **Over-allocating Memory**: Don't allocate 100% of RAM to database\n- **Too Many Connections**: Use connection pooling instead of increasing limits\n- **Disabling Logging**: Keep essential logging for troubleshooting\n- **Unsafe Settings**: Don't sacrifice durability for marginal performance gains\n- **Ignoring Defaults**: Defaults are tuned; only change when necessary\n\n### Performance Optimization Process\n\n1. **Identify Bottleneck**: Use monitoring to find actual bottleneck\n2. **Research Parameter**: Understand what parameter controls bottleneck\n3. **Calculate Value**: Determine appropriate value based on workload\n4. **Test Change**: Apply in staging environment\n5. **Measure Impact**: Compare before/after metrics\n6. **Deploy to Production**: Apply if improvement is significant\n7. **Monitor Continuously**: Watch for unexpected side effects\n\n## Troubleshooting\n\n### Database Won't Start After Parameter Change\n\n**Cause**: Invalid parameter value\n\n**Solution**:\n1. Revert to previous parameter group\n2. Review parameter value\n3. Check parameter limits for your instance size\n4. Apply corrected parameter group\n\n### Performance Degraded After Change\n\n**Cause**: Inappropriate parameter value\n\n**Solution**:\n1. Revert to previous parameter group\n2. Review workload characteristics\n3. Research appropriate values\n4. Test with smaller incremental changes\n\n### Parameter Change Not Taking Effect\n\n**Cause**: Parameter requires restart\n\n**Solution**:\n1. Check if parameter is static (requires restart)\n2. Restart database from dashboard\n3. Verify parameter value after restart\n\n## Related Documentation\n\n- [PostgreSQL](https://docs.danubedata.ro/databases-postgresql)\n- [MySQL](https://docs.danubedata.ro/databases-mysql)\n- [MariaDB](https://docs.danubedata.ro/databases-mariadb)\n- [Database Overview](https://docs.danubedata.ro/databases-overview)\n- [Monitoring Overview](https://docs.danubedata.ro/monitoring-overview)\n- [Performance Optimization Tips](https://docs.danubedata.ro/databases-overview#performance)\n\n","prev":{"title":"Backups","slug":"databases-backups","url":"https://docs.danubedata.ro/databases-backups","markdown_url":"https://docs.danubedata.ro/databases-backups.md","json_url":"https://docs.danubedata.ro/databases-backups.json"},"next":{"title":"Cache","slug":"cache-overview","url":"https://docs.danubedata.ro/cache-overview","markdown_url":"https://docs.danubedata.ro/cache-overview.md","json_url":"https://docs.danubedata.ro/cache-overview.json"},"index_url":"https://docs.danubedata.ro/index.json"}