Friday, 27 February 2026

MYSQL Server VS SQL lite

 

FeatureSQLiteMySQL Server
ArchitectureEmbedded (no server)Client-server
SetupNo installation neededRequires installation & configuration
StorageSingle .db fileManaged database directories
ConcurrencyLimited (best for low write load)High concurrency support
ScalabilitySmall to medium appsMedium to very large systems
User ManagementNone (file-based access)Full user & role system
PerformanceVery fast for local/single-userOptimized for multi-user workloads
BackupCopy the fileDump tools / replication / snapshots


What is SQLite?

SQLite is a lightweight, embedded relational database engine.

Key characteristics:

  • 📦 Serverless — no separate database server process

  • 📁 File-based — entire database is stored in a single file

  • Zero configuration

  • 🔌 Runs inside your application (linked as a library)

Commonly used in:

  • Mobile apps (Android, iOS)

  • Desktop apps

  • Browsers (e.g., local storage engines)

  • Small tools and embedded systems


What is MySQL Server?

MySQL is a full client-server relational database management system (RDBMS).

Key characteristics:

  • 🖥 Runs as a separate database server process

  • 🌐 Supports multiple concurrent users

  • 🔐 Advanced security & user management

  • 📊 Designed for web apps and production systems

Commonly used in:

  • Web applications

  • Enterprise systems

  • APIs & backend services

  • Cloud-hosted platforms



  • A mobile Angular + Capacitor app → SQLite

  • A Node.js backend serving 10,000 users → MySQL Server


SQLite has a built-in .dump command.

Using CLI:

sqlite3 mydatabase.db .dump > dump.sql

This generates a file containing:

  • CREATE TABLE statements

  • INSERT statements

  • Indexes

  • Triggers

Restore from dump:

sqlite3 newdatabase.db < dump.sql

🔹 2️⃣ Simple Backup (Copy the File)

Because SQLite is just a single file:

cp mydatabase.db backup.db

⚠️ Important:
If the database is being written to, use the .backup command instead:

sqlite3 mydatabase.db ".backup backup.db"




🔹 2️⃣ Read Performance

SQLite is very fast for reads.

It can handle:

  • Thousands of SELECT queries per second

  • Many concurrent readers

  • Great performance for cached data

Reads do NOT block other reads.


🔹 3️⃣ Write Concurrency (Important Limitation)

SQLite allows:

🚨 Only ONE writer at a time.

That means:

  • Multiple users can read simultaneously

  • But writes are serialized (queued)

If many users try to write at the same time:

  • You’ll see database is locked errors

  • Performance drops under heavy write load


Rough Practical Numbers

These are approximate real-world observations:

Workload TypeWhat SQLite Can Handle
Reads10,000+ per second (depending on hardware)
Writes100–1,000 small writes/sec (serialized)
Concurrent UsersDozens fine, hundreds depends on workload
Database SizeMulti-GB very common



MySQL support concurrent writes?

Yes — especially when using the default engine InnoDB (the default in modern MySQL).

It supports:

  • Multiple concurrent writers

  • Row-level locking

  • Transactions (ACID compliant)

  • MVCC (Multi-Version Concurrency Control)

This is very different from SQLite, which allows only one writer at a time.

No comments:

Post a Comment