# CFX-DB vs OxMySQL: Which Should You Use?

URL: https://rivo.tools/docs/cfx-db-cfx-db-vs-oxmysql-which-should-you-use

Based on production framework testing (ESX, QBCore, custom frameworks) and synthetic benchmarks

✅

#### Use CFX-DB When:

##### You're Running a Framework Server (ESX, QBCore, etc.)

Production framework environments with complex multi-table operations and real-time features.

Why: CFX-DB outperforms OxMySQL in real-world framework usage. Server-side optimized functions handle framework patterns better than raw SQL. Tested on private frameworks with 300+ concurrent players.

##### Atomic Transactions Are Critical

Money transfers, inventory trades, business transactions, or any multi-step operations.

Why: CFX-DB is 1.1x FASTER than OxMySQL for atomic transactions (169 ms vs 180 ms). Server-side mutations ensure all operations succeed or fail together - critical for framework integrity.

##### Real-time Features Are Essential

Live leaderboards, faction rosters, server dashboards, economy tracking, or any frequently-updated data.

Why: Push-based subscriptions eliminate polling entirely. 50% fewer queries with instant updates when data changes. Perfect for framework HUDs and dashboards.

##### You Want Zero Database Management

No time to manage MySQL servers, tune queries, or handle database crashes at 3 AM.

Why: Convex handles everything: automatic backups, auto-scaling, monitoring. Focus on building framework features, not database operations.

##### Scalability & Performance Matter

Planning to grow from 100 to 500+ players or run multiple framework servers.

Why: Auto-scales automatically with optimized server-side functions. Framework operations get faster with CFX-DB's intelligent caching and batching.

BEST FOR

Framework servers (ESX, QBCore, custom) with 100-1000+ players. Production-tested and optimized for framework patterns. Best choice for teams that value reliability, scalability, and modern developer experience.

⚠️

#### Use OxMySQL When:

##### You're Running a Simple/Non-Framework Server

Basic gamemodes without complex transactions or real-time features.

Why: If you're not using a framework and just need simple CRUD operations, OxMySQL's local protocol is marginally faster for basic queries.

##### You Already Have Everything Built

Existing server with hundreds of custom scripts tightly coupled to OxMySQL.

Why: Migration cost may outweigh benefits if you're not experiencing performance issues. Stick with what works unless you need CFX-DB's framework optimizations.

##### You Have Deep MySQL Expertise

Database administrator on staff, custom query optimization, advanced SQL features.

Why: If you're already optimizing MySQL at the query level and managing replication/sharding, you may not need CFX-DB's abstractions.

##### You Need Full Infrastructure Control

Self-hosting everything, vendor independence, or regulatory requirements.

Why: OxMySQL gives complete infrastructure control. CFX-DB depends on Convex (self-hosting available but more complex).

##### Very Small Server (<50 Players)

Hobby server with minimal traffic and no growth plans.

Why: For tiny servers, the performance difference won't be noticeable. Stick with free MySQL hosting if budget is tight.

BEST FOR

Simple gamemodes, established non-framework servers, or teams with dedicated MySQL DBAs. Not recommended for framework servers (ESX, QBCore, etc.).
