Skip to main content
Backend

Database Selection for Web Applications

3 September 2025 AAM Services
Database Selection for Web Applications

Every web application needs to store data, and the database choice affects performance, flexibility, and development complexity. The landscape has evolved beyond "just use MySQL"—there are now genuine alternatives with different trade-offs. Understanding these options helps you make informed decisions.

The Fundamental Divide: SQL vs NoSQL

Databases broadly fall into two categories:

SQL (relational) databases organise data in tables with defined schemas. Tables relate to each other through keys. You query them using SQL, a standardised language. Examples: PostgreSQL, MySQL, MariaDB, SQL Server.

NoSQL databases are everything else—a catch-all term for non-relational approaches. They might store documents (MongoDB), key-value pairs (Redis), wide columns (Cassandra), or graphs (Neo4j). Each has different query mechanisms.

This division isn't as clean as it once was. PostgreSQL now handles JSON documents well. MongoDB has added features that look increasingly relational. But the fundamental approaches remain distinct.

When SQL Databases Excel

Relational databases have dominated for decades for good reasons:

Structured Data with Relationships

When your data has clear structure and entities relate to each other—customers have orders, orders contain products, products belong to categories—relational databases model this naturally. Foreign keys enforce data integrity.

Complex Queries

SQL is remarkably expressive. Joining tables, filtering, aggregating, grouping—queries that would require complex application code in document databases are often single SQL statements. For reporting and analytics, SQL is powerful.

Data Integrity

ACID transactions (Atomic, Consistent, Isolated, Durable) ensure that operations complete fully or not at all. When you transfer money between accounts, both the debit and credit must succeed. Relational databases handle this reliably.

Schema as Documentation

The database schema documents your data model. New developers can understand the structure by examining tables. Migrations track how the model evolves over time.

Mature Ecosystem

Decades of development mean excellent tooling, extensive documentation, and battle-tested reliability. PostgreSQL, in particular, is remarkably capable and completely free.

When NoSQL Databases Excel

Non-relational databases emerged to address specific limitations:

Flexible Schemas

When data structure varies between records or evolves rapidly, document databases accommodate this naturally. Each document can have different fields without schema migrations.

Hierarchical Data

If your data is naturally nested—a blog post with embedded comments with embedded replies—document databases store this directly rather than across multiple tables requiring joins.

Horizontal Scaling

Some NoSQL databases were designed for distributed deployment across many servers. For extremely high traffic or massive data volumes, this can be advantageous. (Though PostgreSQL scales further than many assume.)

Specific Access Patterns

Key-value stores like Redis are extraordinarily fast for simple lookups. Graph databases excel when relationships are the primary query concern. Choose the right tool for specific access patterns.

Practical Recommendations

Based on our experience building applications, here's practical guidance:

PostgreSQL as Default

For most web applications, PostgreSQL is our default recommendation. It handles structured and semi-structured data (JSON), scales well beyond most applications' needs, has excellent tooling, and is genuinely free.

Many NoSQL use cases are actually well-served by PostgreSQL's JSONB type. You get document flexibility within a relational database, with the option to add constraints and indexes as structure crystallises.

MySQL/MariaDB for Legacy Compatibility

Many existing systems (WordPress, Magento, OpenCart) use MySQL. If you're working within those ecosystems, MySQL is the natural choice. It's capable and well-supported.

MongoDB for Document-Native Use Cases

When your data is genuinely document-oriented—content management systems, product catalogues with varied attributes, user-generated content with flexible structure—MongoDB can be a good fit. Its developer experience is smooth, particularly for JavaScript developers.

Redis for Caching and Sessions

Redis isn't typically a primary database but excels as a complementary cache, session store, or real-time data structure server. Extremely fast, simple, and effective.

SQLite for Simplicity

For smaller applications, SQLite stores the entire database in a single file. No server to manage, trivial backups, excellent performance for modest scale. Many applications never outgrow it.

Common Misconceptions

The SQL vs NoSQL debate has generated myths worth addressing:

"NoSQL is faster": Not inherently. Performance depends on data model, query patterns, and implementation. PostgreSQL is extremely fast for appropriate workloads.

"SQL doesn't scale": Modern SQL databases scale far beyond what most applications require. Read replicas, sharding, and connection pooling address scaling challenges. Many of the world's largest services run on relational databases.

"NoSQL means no schema": Your application still has expectations about data structure. Schemaless databases shift schema enforcement from the database to the application—sometimes that's a feature, sometimes a foot-gun.

"NoSQL is more modern": Age doesn't determine quality. PostgreSQL continues to evolve with modern features. Use what solves your problem best.

Making the Decision

When choosing a database, consider:

Data structure: Is your data highly relational, or more document-oriented? Are relationships between entities important to query?

Query patterns: What questions will you ask of the data? Complex joins and aggregations suit SQL. Key-based lookups suit simpler stores.

Consistency requirements: How important are transactions and data integrity? Financial data demands ACID guarantees. Social media feeds can tolerate eventual consistency.

Scale requirements: Be honest about your actual scale. Most applications never need distributed databases. Premature optimisation wastes effort.

Team expertise: What does your team know? SQL skills are broadly transferable. Each NoSQL database has its own learning curve.

Ecosystem fit: What does your framework expect? Rails and Django work beautifully with PostgreSQL. Node.js developers often reach for MongoDB. Fighting ecosystem expectations has costs.

Hybrid Approaches

Many applications use multiple databases for different purposes:

  • PostgreSQL for transactional data
  • Redis for caching and sessions
  • Elasticsearch for full-text search
  • S3 for file storage

This is fine—use appropriate tools for different jobs. But don't add complexity without justification. One database that handles your needs is simpler than three.

Our Approach

When we build applications with FeathersJS or custom backends, we typically start with PostgreSQL unless there's a specific reason to choose otherwise. It handles most requirements elegantly, and we know it deeply.

For applications with specific needs—heavy caching, flexible content structures, real-time features—we'll recommend appropriate additions or alternatives.

If you're planning an application and wondering about database architecture, get in touch. We're happy to discuss your specific requirements and recommend an appropriate approach.

Ready to Start Your Project?

Have questions about building your eCommerce store or custom web application? Let's talk.