Minecraft Server Database Optimization: How to Configure MySQL and SQLite for Maximum Performance
# Minecraft Server Database Optimization: MySQL and SQLite for Maximum Performance
If your Minecraft server runs plugins like LuckPerms, EssentialsX, CoreProtect, ShopGUI+, or any economy plugin — you're running a database. And if that database is poorly configured, it can silently drain your server's TPS and cause lag spikes that have nothing to do with entities or chunk loading.
This guide covers how to properly configure MySQL and SQLite for Minecraft servers, when to choose one over the other, and how to squeeze maximum performance out of your data layer.
---
Why Database Performance Matters for Minecraft Servers
Most server admins focus on entity counts, view distance, and JVM flags — but overlook the database entirely. Here's why that's a mistake:
- Plugins like CoreProtect log every block interaction. On a busy server, this generates thousands of write operations per minute.
- LuckPerms, EssentialsX, and CMI frequently read and write player data on join, quit, and during gameplay.
- Slow database queries run synchronously in many older plugins, which means they block the main server thread and directly tank your TPS.
- Connection timeouts or misconfigured pools cause plugins to freeze while waiting for a database response.
---
SQLite vs MySQL: Choosing the Right Backend
SQLite
SQLite stores everything in a single .db file. It requires zero setup and works out of the box — which is why it's the default for most plugins.
Use SQLite when:
- You run a small server (under 20 concurrent players)
- You don't need multi-server synchronization
- Simplicity matters more than raw performance
SQLite limitations:
- Single-writer architecture — only one write at a time
- Performance degrades with large datasets (100k+ rows)
- Not suitable for BungeeCord/Velocity networks
MySQL / MariaDB
MySQL is a full client-server database engine. MariaDB is a community fork that's often faster and more compatible with Minecraft plugin drivers.
Use MySQL when:
- You have 20+ concurrent players
- You run a network with multiple servers
- Plugins generate heavy write loads (CoreProtect, LogBlock)
- You need better performance under concurrent access
> Recommendation: For any serious server, use MariaDB 10.6+ instead of MySQL. It has better performance for the mixed read/write workloads that Minecraft plugins generate.
---
Configuring MySQL for Minecraft Plugins
Connection Pooling with HikariCP
Many modern plugins (LuckPerms, CoreProtect 22+, Plan) use HikariCP for connection pooling. This is critical for performance — without it, every database operation opens and closes a new connection, which is extremely slow.
In LuckPerms (config.yml):
storage-method: mysql
data:
address: localhost:3306
database: luckperms
username: luckperms_user
password: yourpassword
pool-settings:
maximum-pool-size: 10
minimum-idle: 10
maximum-lifetime: 1800000
keepalive-time: 0
connection-timeout: 5000
Key settings explained:
maximum-pool-size: Number of simultaneous connections. For most servers,10is sufficient. Increase to20on high-traffic networks.maximum-lifetime: Close and reopen connections after 30 minutes to prevent stale connections.connection-timeout: If a connection isn't available within 5 seconds, throw an error instead of hanging indefinitely.
MySQL Server Configuration
If you're self-hosting MariaDB, edit /etc/mysql/mariadb.conf.d/50-server.cnf:
[mysqld]
innodb_buffer_pool_size = 256M
innodb_log_file_size = 64M
innodb_flush_log_at_trx_commit = 2
max_connections = 150
query_cache_type = 0
query_cache_size = 0
innodb_buffer_pool_size: Cache for frequently accessed data. Set to 25-50% of available RAM on dedicated database servers.innodb_flush_log_at_trx_commit = 2: Flushes to disk every second instead of every transaction. Significantly faster, with minimal data loss risk (at most 1 second of data on crash).query_cache_size = 0: The query cache is deprecated in modern MySQL/MariaDB and actually causes contention. Disable it.
---
Optimizing Specific Plugins
CoreProtect
CoreProtect is one of the most database-intensive plugins available. On active survival servers, it can generate millions of rows per day.
In config.yml:
mysql: true
host: localhost
port: 3306
database: coreprotect
username: coreprotect_user
prefix: co_
world-edit: true
Performance tips:
- Run
co purge t:30dmonthly to delete logs older than 30 days - Use MySQL instead of SQLite — the difference is night and day on busy servers
- Consider running CoreProtect on a separate MariaDB instance if you have a high-traffic server
EssentialsX
Essentials stores player data as individual YAML files by default, which is actually faster than a database for small servers due to file system caching. However, on servers with 10,000+ unique players, the /userdata/ folder becomes massive.
For large servers, consider switching to EssentialsX with H2 or migrating to CMI which uses a more efficient storage backend.
Plan (Player Analytics)
Plan is notoriously database-heavy. In config.yml:
Database:
Type: MySQL
MySQL:
Host: localhost
Port: 3306
User: plan_user
Password: yourpassword
Database: plan
Max_connections: 8
Launch_options: "?rewriteBatchedStatements=true&useSSL=false"
The rewriteBatchedStatements=true option is critical — it batches multiple INSERT statements into a single network call, dramatically reducing write overhead.
---
Diagnosing Database Lag
Not sure if your database is the bottleneck? Here's how to find out:
- Use
/timings report(Paper/Spigot) or /spark — look for plugin tasks taking more than 1ms. Database plugins often show up asAsyncPlayerPreLoginEventor scheduled tasks.
- Enable slow query logging in MariaDB:
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 0.5
This logs any query taking over 500ms — a common source of hidden lag.
- Monitor connection pool exhaustion — if your plugin logs show
connection timeouterrors, increasemaximum-pool-size.
Tools like PulseNode can help you correlate TPS drops with plugin activity over time, making it much easier to identify whether a database-heavy plugin is causing periodic lag spikes during peak hours.
---
Quick Reference: Database Optimization Checklist
- [ ] Switch from SQLite to MySQL/MariaDB for servers with 20+ players
- [ ] Use MariaDB 10.6+ instead of MySQL for better performance
- [ ] Enable HikariCP connection pooling in all supported plugins
- [ ] Set
innodb_flush_log_at_trx_commit = 2in MariaDB config - [ ] Disable the MySQL query cache
- [ ] Add
rewriteBatchedStatements=trueto JDBC connection strings - [ ] Schedule regular CoreProtect purges
- [ ] Enable slow query logging to catch problem queries
- [ ] Keep your database on the same physical machine as your server (or same LAN) to minimize latency
---
Conclusion
Database performance is one of the most overlooked aspects of Minecraft server optimization — yet it's often responsible for mysterious lag spikes that don't show up in entity or chunk profiling. By switching to MariaDB, configuring connection pools correctly, and keeping your plugin data clean, you can eliminate an entire category of server lag.
If you want to monitor how your database-heavy plugins affect TPS over time, PulseNode provides real-time server performance tracking that helps you identify exactly when and why your server slows down — no guesswork required.