Skip to content
← All posts
·3 min read

SQL vs NoSQL: How Databases Power the Apps You Use

DatabaseSQLNoSQLPostgreSQLMongoDB

Every app you use is mostly a friendly interface on top of a database. Your bank balance, your orders, your messages: all rows or documents somewhere. Picking the right kind of database early saves painful migrations later, so here's how I explain the choice to clients.

What a database actually does

At its simplest, a database stores data safely and answers questions about it quickly. "Show me this user's last ten orders." "How much was given online this month?" "Which farms near Lagos have eggs in stock?"

The two big families, SQL and NoSQL, make different trade-offs about how data is shaped and how strictly it's checked.

SQL: tables and relationships

Relational databases like PostgreSQL and MySQL store data in tables with fixed columns, and link tables through relationships. They shine when your data is connected: users have orders, orders have payments, payments belong to campaigns.

Take online giving on a church platform like NWPM, which runs through Paystack with each payment verified on the server. Once payments are stored against members, a question like "total given per member" is one query:

SELECT users.name, SUM(payments.amount) AS total_given
FROM payments
JOIN users ON users.id = payments.user_id
WHERE payments.status = 'success'
GROUP BY users.name
ORDER BY total_given DESC;

What SQL databases give you:

  • Constraints: a payment must reference a real user, and an amount can't be null.
  • Transactions: either the order and the stock update both happen, or neither does.
  • Powerful queries: joins, aggregates and reports without moving data around.

NoSQL: flexible documents

Document databases like MongoDB store records as JSON-like documents. Each document can have its own shape, and related data is often nested inside it rather than split across tables.

{
  "_id": "evt_1029",
  "type": "listing_viewed",
  "userId": "u_42",
  "meta": { "listingId": "l_77", "source": "search", "device": "android" },
  "at": "2026-11-20T09:14:00Z"
}

That flexibility is great for data whose shape varies or changes often: activity feeds, logs, analytics events, content with many optional fields.

The trade-off is that the database does less checking for you. Relationships and consistency become your application's job.

Side by side

SQL (PostgreSQL)NoSQL (MongoDB)
Data shapeFixed tables and columnsFlexible documents
RelationshipsFirst-class (joins, foreign keys)Manual or embedded
ConsistencyStrong, with transactionsConfigurable; more on you
Great forUsers, orders, payments, bookingsLogs, events, varied content

Which should you pick?

Start with PostgreSQL unless you have a clear reason not to. Most business apps are full of relationships: customers, orders, payments, inventory. Postgres protects that data with constraints and transactions as the app grows. It also handles flexible data well when you need it, through jsonb columns.

That's why I default to Postgres for anything that touches payments. On NWPM I used it through Supabase, which adds auth, storage and row-level security on top.

Reach for a document database when your data genuinely is document-shaped and loosely connected, or when a specific workload (huge event streams, for example) calls for it.

The takeaway

Choose your database by the shape of your data and the questions you'll ask of it, not by what's trendy. For most apps that handle money, users and orders, that answer is a relational database, and PostgreSQL is a great one.

Planning a new app and not sure how to structure the data? Let's talk it through.

Available for work