- 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
MySQL vs PostgreSQL for Laravel Projects: An Honest, Benchmark-Free Comparison
About Post
Every few months someone on the internet declares that PostgreSQL is the only serious database and MySQL is for people who don't know better. A few days later, someone else points out that a huge share of the web runs happily on MySQL and always has.
Both camps are partly right, and neither helps you choose a database for your next Laravel project on a Tuesday afternoon.
So let's skip the tribal part and the benchmarks. I work mostly with MySQL, and I like PostgreSQL a lot. Here's where the two genuinely differ in ways a Laravel developer will feel, and how I'd decide.
First, the good news
For a typical Laravel app (users, orders, invoices, contracts, a few reports) both are excellent. Eloquent, migrations, the query builder, queues and sessions all work the same on either. If you write normal Laravel code, you can build the whole app without touching anything database-specific.
Both are mature, transactional, fast for this kind of workload, and available as managed services on every major cloud (on AWS, RDS offers both). Neither choice will sink a project. The differences show up at the edges, and the edges are where your specific project lives.
At a glance
| MySQL | PostgreSQL | |
|---|---|---|
| JSON | JSON type; index specific paths via generated columns or functional indexes | jsonb with GIN indexes that can cover whole documents |
| Full-text search | Built-in FULLTEXT indexes | Built-in tsvector search with language configs |
| Extensions | Limited | Rich: PostGIS, pgvector, pg_trgm and many more |
| Schema changes | DDL commits implicitly; no rollback | Transactional DDL |
| Partial indexes | No | Yes |
| Default text comparison | Case-insensitive (with the usual collations) | Case-sensitive |
| Hosting availability | Everywhere, including shared hosting | All major clouds; less common on cheap hosting |
Where PostgreSQL pulls ahead
JSON you actually query
Both databases store JSON, and Laravel's whereJsonContains and -> path syntax work on both. The difference is indexing. In MySQL you typically index a specific JSON path through a generated column or a functional index, which is fine when you know the paths in advance. Postgres's jsonb with a GIN index can make containment queries fast across the whole document. If JSON columns are central to your design rather than a side detail, Postgres is more comfortable.
Extensions
This is Postgres's biggest advantage. PostGIS for serious geospatial work. pgvector for storing embeddings and running similarity search next to your normal data, which has become very relevant for AI features. pg_trgm for fuzzy text matching. With MySQL, some of those needs mean adding another service.
Safer migrations and smarter indexes
Transactional DDL means a migration that fails halfway can roll back cleanly instead of leaving a half-changed schema. Partial indexes let you index just the rows you query, like WHERE deleted_at IS NULL, or enforce "only one active contract per unit" with a unique index on a subset of rows.
Where MySQL is the easier choice
- Familiarity and ecosystem. Most PHP developers have years of MySQL experience. Most tutorials, hosting panels, backup scripts and admin tools assume it.
- Operations. Postgres needs a little more understanding to run well: vacuuming, connection limits (a pooler such as PgBouncer is common at scale). Managed services handle much of this, but someone on the team should understand it.
- Forgiving text comparison. Case-insensitive matching by default is usually what business apps want for names and emails.
- Existing systems. If your other apps, reports and integrations already use MySQL, one engine across the company is a real advantage.
Gotchas when switching between them
These are the ones that bite Laravel apps moving from one to the other:
- Case-sensitive
LIKE. On Postgres,where('name', 'like', '%sara%')won't match "Sara". UsewhereLike('name', '%sara%'), which is case-insensitive by default and generates the right SQL for each database. - Stricter types. Postgres refuses comparisons MySQL would quietly coerce, like a string against an integer column. Good discipline, but expect a few errors in older code.
- Upserts. Laravel's
upsert()on MySQL and MariaDB ignores the "unique by" columns you pass and uses the table's primary and unique indexes. Postgres needs a unique index on exactly those columns. Code that works on one can fail on the other. - Raw SQL.
DB::raw()with MySQL-only functions (DATE_FORMAT,GROUP_CONCAT,IFNULL) needs rewriting. Search for them before you estimate a migration. - Enum columns. On Postgres, Laravel implements
enum()as a string column with a check constraint, not a native enum type. Usually fine; just know it.
The rule: run your test suite against the same database engine you use in production. SQLite in tests and MySQL or Postgres in production hides exactly the differences listed above.
How I'd decide
Choose PostgreSQL when:
- you'll query JSON heavily, need geospatial queries, or want vector search inside your main database
- data integrity rules benefit from partial unique indexes and stricter typing
- the team knows Postgres, or is keen to learn it properly
Choose MySQL when:
- the team and the company's existing systems already run on it
- the app is a classic business CRUD system with relational data and reports
- you want the most widely understood, widely hosted option
And when none of those apply strongly? Pick the one your team can operate confidently at 2 a.m. Backups, restores, upgrades, slow-query investigation: that knowledge matters more than any feature in the table above.
The short version
- For typical Laravel apps, both are excellent.
- Postgres wins on extensions,
jsonb, transactional DDL and partial indexes. - MySQL wins on familiarity, ubiquity and forgiving defaults.
- Team familiarity is a legitimate technical reason, not a cop-out.
What does your team run, and what would make you switch? I'm curious whether pgvector has tipped anyone towards Postgres for AI features.

Be first to comment it...