- Knowledge
- technology
- OOP
- Tips
- Programming
- Tips
- Tutorial
- SEO
- Ranking
- Knowledge
- Special Day
- Seo
- Bug
- Data science
- Seo
- artificial intelligence
- Machine Learning
- Robotics
- happyNewYear2021
- newYearEve
- 2021
- Automation
- Smart Home
- Career
- Best Practices
- Git
- Logging
- Web Fundamentals
- DNS
- HTTPS
- Performance
- AI Tools
- ChatGPT
- Claude
- Gemini
- Laravel
- Eloquent
- MySQL
- HTTPS
- TLS
- Web Security
- Certificates
- Developer Life
- Debugging
- Docker
- DevOps
- Transactions
- Queues
- LLMs
- AI
- AI Coding
- Developer Tools
- React Native
- Expo
- Kate PMS
- Mobile Apps
- Laravel
- Authentication
- Sanctum
- Cookies
- API Design
- Payments
- Idempotency
- DeepSeek
- Open Source AI
- LLMs
- AI News
- Git
- Version Control
- AI Coding
- Prompting
- PHP
- Checklist
- MCP
- AI Agents
- OpenAI
- Architecture
- Microservices
- Modular Monolith
- Estimation
- Developer Life
- Project Planning
- Humour
- OAuth
- OpenID Connect
- Authentication
- Embeddings
- Vector Search
- RAG
- pgvector
- OpenAI
- GPT-4.1
- Codex CLI
- Events
- Testing
- Clean Code
- Maintainability
- Code Review
- Webhooks
- API
- Security
- Claude Code
- Workflow
- AI
- LLM
- Prompt Injection
- Mobile
- React
- Networking
- TCP
- UDP
- HTTP/3
- CLAUDE.md
- AWS
- Cloud Security
- Backups
- PHPUnit
- Software Engineering
- Leadership
- Communication
- RAG
- Embeddings
- AI Engineering
- IT Infrastructure
- Networking
- Access Control
- CI/CD
- GitHub Actions
- Gemini CLI
- Claude Code
- JavaScript
- Async/Await
- Node.js
- Promises
- Security
- Cryptography
- Passwords
- MySQL
- Database
- Vibe Coding
- Software Quality
- DNS
- Code Reading
- Onboarding
- Productivity
- Background Jobs
- Developer Humour
- Estimates
- Dev Life
- JWT
- o3-mini
- DeepSeek R1
- Rate Limiting
- Kate PMS
- E-Signing
- Audit Trail
- REST
- GraphQL
- API Design
- Laravel 12
- Upgrade Guide
- Open Source
- Self-Hosting
- Task Scheduling
- Cron
- Secrets
- CORS
- PHP
- PHP-FPM
- OPcache
- GitHub Copilot
- Software Architecture
- Engineering
- TypeScript
- JavaScript
- Type Safety
- AI Security
- React Native
- Product Design
- AI Agents
- Kiro
- Queues
- Redis
- RabbitMQ
- AWS SQS
- Nginx
- Apache
- GPT-5
- gpt-oss
- Clean Code
- Architecture
- Naming
- Documentation
- Career
- ADR
- Teamwork
- Supply Chain
- Kate HRM
- HR Software
- Permissions
- System Design
- Pagination
- SSH
- Linux
- Big O
- Databases
- Laravel Boost
- MCP
- Developer Skills
- Validation
- Databases
- Indexes
- Code Quality
- Deployment
- Developer Humour
- Feature Flags
- Code Review
- Pull Requests
- Docker
- Cursor
- Authorization
- RBAC
- Gemini
- Long Context
- PHP 8.4
- Caching
- Dependency Injection
- Web Performance
- Browser
- CSS
- Database
- Migrations
- ChatGPT
- AI for Developers
- Monitoring
- On-Call
- REST
- Backend
- SQL
- NoSQL
- Database Design
- Coding Agents
- Claude 4
- API Resources
- REST API
- Load Balancing
- Scaling
- AWS
- AI Tools
- Claude
- Sora 2
- CTE
- 2FA
- TOTP
- Programming Languages
- Prompts
- Developer Workflow
- API Gateway
- APIs
- Passport
- API Auth
- Learning
- Burnout
- Developer Growth
- Web Development
- SEO
- Kate Mall
- ChatGPT Atlas
- Agent Skills
- Middleware
- Laravel 12
- Collections
- Context Window
- Monitoring
- Commit Messages
- Self Review
- Growth
- Regex
- Programming Basics
- Text Processing
- Database Design
- Normalization
- Linux
- Server Security
- Linux Foundation
- Open Standards
- Legacy Code
- Documentation
- AI Workflow
- File Uploads
- Test Data
- Hashing
- Performance
- Caching
- Enums
- Scope Creep
- Estimation
- Codex
- Gemini CLI
- Timezones
- Carbon
- Bugs
- PHP 8.5
- Gemini 3
- GPT-5.1
- Data Integrity
- Event Loop
- Async
- Opus 4.5
- AI Models
- React
- Forms
- Frontend
- Backups
- AI Images
- DALL-E
- Midjourney
- Race Conditions
- Concurrency
- Legacy Code
- Refactoring
- Senior Engineer
- Scope
- LLM
- CDN
- Web
- Sub-Agents
- Soft Deletes
- Audit Log
- Concurrency
- AI Learning
- NestJS
- AI Evals
- Policies
- SPF DKIM DMARC
- Unicode
- UTF-8
- Knowledge Graph
- Value Objects
- Technical Debt
- Feature Flags
- Laravel Pennant
- Deployment
- Copilot
- Composer
- Dependencies
- Artisan
- Automation
- AWS S3
- Object Storage
- Cloud
- Small Language Models
- Ollama
- Production
- Sessions
- HTTP
- Mentoring
- SQL
- Virtual Machines
- Web Development
- HTTP/2
- QUIC
- Web Performance
- AI Integration
- LLM API
- SOLID
- OOP
- Hosting
- Serverless
- Merge Conflicts
- Temperature
- AI Development
- Reverse Proxy
- Nginx
- Infrastructure
- Verification
- Passkeys
- WebAuthn
- Teams
- Communication
- Stakeholders
- Monorepo
- CI/CD
- Versioning
- JSON Schema
- Livewire
- Inertia
- Meetings
- Distributed Systems
- Privacy
- Full-Stack
- T-Shaped Skills
- Money
- Notifications
- Web Security
- HTTP Headers
- CSP
- Function Calling
- Load Testing
- k6
- Data Extraction
- Debugging
- WebSockets
- SSE
- Real-Time
- Laravel Reverb
- Infrastructure as Code
- Terraform
- Side Projects
- Laravel Pint
- OpenAPI
- Swagger
- UX
- Multimodal
- Jest
- Pair Programming
- APIs
- Rate Limiting
- Resilience
- Dev Humour
- Design Tokens
- JWT
- API Keys
- Sessions
- PHPStan
- Rector
- Incidents
- Reporting
- Dashboards
- Zero Trust
- IAM
- Search
- Laravel Scout
- Junior Developers
- Mentoring
- Images
- WebP
- AVIF
- Bug Reports
- Let's Encrypt
- Design Docs
- Software Design
- Observers
- Replication
- Accountability
- Data Structures
- Reliability
- LLM Memory
- Error Handling
- Payments
- Payment Gateway
- Webhooks
- PCI DSS
- Observability
- OpenTelemetry
- Personal Brand
- Writing
- Conventions
- Dates
- Scheduling
- Disaster Recovery
- Compression
- Brotli
- Deadlines
- Developer Habits
- State Machines
- Tech Roles
- UUID
- ULID
- Horizon
- Planning
- Engineering Culture
- Ownership
- Soft Skills
- Socialite
- Cost Control
- Collations
- Unicode
- Octane
- PostgreSQL
SQL vs NoSQL: How to Choose a Database Without the Hype
About Post
Somewhere right now, a team is choosing MongoDB because "SQL doesn't scale", and another team is forcing a deeply nested, constantly changing document into twelve relational tables because "NoSQL is for hipsters". Both teams will spend the next year paying for a decision they made in an afternoon.
SQL versus NoSQL isn't a fashion choice. It's a question about the shape of your data and the questions you'll ask of it. Let's clear out the myths first, then talk about how to actually choose.
First, what we're comparing
Relational databases (MySQL, PostgreSQL, SQL Server) store data in tables with a fixed schema, connect them with keys, and let you ask almost any question with SQL. They give you transactions, constraints and joins as standard.
"NoSQL" is a loose label for several quite different things:
- Document stores (MongoDB, Firestore): JSON-like documents, flexible structure per record.
- Key-value stores (Redis, DynamoDB at its simplest): look up a value by its key, extremely fast.
- Wide-column stores (Cassandra): built for huge write volumes spread over many machines.
- Graph databases (Neo4j): relationships are the main thing you query.
"Should we use NoSQL?" is therefore a slightly broken question. Redis and Neo4j have almost nothing in common except what they're not.
Myth vs reality
Myth: "NoSQL is faster"
Reality: NoSQL databases are fast at the access patterns they were designed for. A key-value lookup in Redis is hard to beat. But ask a document store for something it wasn't modelled for, like a report joining three collections, and it gets slow or awkward quickly. A well-indexed relational query is very fast too. Speed comes from matching the database to the query, not from the category.
Myth: "SQL doesn't scale"
Reality: relational databases run some of the largest applications on the internet. They scale up (bigger machines), out for reads (replicas), and further with caching and partitioning. What's genuinely harder with SQL is spreading writes across many machines. If you need that, you'll know, and most applications never get near it.
Myth: "NoSQL means no schema"
Reality: it means the database doesn't enforce one. Your application still expects fields to exist and have certain types. The schema just moves into your code, and old documents with old shapes stay around forever. Flexible on day one often means defensive if statements by day three hundred.
Myth: "NoSQL can't do transactions"
Reality: out of date. MongoDB has supported multi-document ACID transactions since version 4.0. But transactions aren't the default way you work there, and modelling is meant to keep related data in one document so you rarely need them. In a relational database, transactions are the everyday tool.
The real trade-off, in one table
| Relational (SQL) | Document (NoSQL) | |
|---|---|---|
| Schema | Enforced by the database | Enforced by your code (if at all) |
| Relationships | Joins, foreign keys | Embed in the document, or join in code |
| Integrity | Constraints, unique keys, transactions everywhere | Per-document by default, transactions available |
| Queries | Ask almost anything, even unplanned | Fast for planned access patterns |
| Changing structure | Migrations | Just write the new shape (old shapes remain) |
| Scaling writes | Harder | Often designed for it |
The row that matters most for business software is "ask almost anything, even unplanned". Requirements change. Finance will ask for a report you didn't design for. In a relational database, that's a new query. In a store modelled around specific access patterns, it can be a data migration.
When NoSQL is genuinely the right call
- Caching, sessions, rate limits, queues: Redis, without much debate.
- Huge write volume with simple, known access patterns: events, sensor data, activity feeds, where you'll read by key and time.
- Truly variable records that you read and write as a whole and rarely query across, like per-user settings or content with very different fields per type.
- Serverless or real-time mobile setups where a managed document store (Firestore, DynamoDB) saves you running anything yourself.
Notice that most real systems end up with both: a relational database as the source of truth, plus Redis for speed. That's not indecision. That's using each tool for its job.
The middle ground: JSON columns in MySQL
Often what people want from NoSQL is "a few flexible fields". You don't need a second database for that. MySQL (5.7 and later) has a native JSON column type, and Laravel speaks it fluently:
Schema::table('units', function (Blueprint $table) {
$table->json('features')->nullable();
});
// Query inside the JSON
Unit::where('features->furnished', true)
->whereJsonContains('features->amenities', 'parking')
->get();
Cast it with 'features' => 'array' on the model and you read and write it as a normal PHP array.
The catch: you can't index a JSON column directly. If you filter on one key a lot, expose it as a generated column and index that:
Schema::table('units', function (Blueprint $table) {
$table->boolean('is_furnished')
->virtualAs("features->>'$.furnished' = 'true'");
$table->index('is_furnished');
});
Now you have flexible attributes and fast filtering, inside the same transactional database as the rest of your data.
My default: start relational. Add JSON columns for genuinely flexible attributes, Redis for speed, and a specialised store only when you can name the access pattern that the relational database can't handle. "Might need to scale one day" is not that pattern.
Three questions to decide
- Do my records relate to each other, and do I need those relationships to stay correct? Contracts, tenants, invoices, payments: yes, very much. Relational.
- Do I know every way I'll query this data? If not, relational keeps your options open.
- Is my bottleneck write volume across many machines, or simple key lookups at huge scale? If yes, and you can measure it, that's where NoSQL earns its place.
What's your stack's split? Fully relational, fully document, or the very common "MySQL plus Redis" combination?

Be first to comment it...