Databases
MySQL or PostgreSQL: start with the data and queries
Choose a database around your application: data modelling, constraints, queries, indexes, operations and compatibility with an existing system.
Database selection can become a debate between technologies. More useful project questions are what information you store, how it connects and which operations must remain responsive and reliable under realistic load.
The key decision
Compare MySQL and PostgreSQL against actual queries, team experience and operational requirements. There is no universal winner for every application.
Model the rules before optimising
Separate the main entities and their relationships. Customers, orders and products have different lifecycles. Decide which values must be unique, which fields are required and what deleting a record means for its history.
For example, changing a product’s current price should not automatically alter the amount in an old order. That is a modelling and business-rule question that the database choice will not resolve by itself.
Test important operations with realistic data
Choose representative queries: catalogue search, pending orders and monthly reporting. Prepare a dataset close to the expected volume and inspect execution plans. Indexes should support specific queries rather than being added mechanically to every column.
Measure writes as well as reads. Transactions, concurrent changes and locking behaviour may matter more than a single demonstration query’s speed.
Compare the entire operating environment
Support for the chosen version, available tools and team experience are part of the decision. Switching databases because of popularity can add work without a measurable benefit.
- Compatibility with the application, libraries and existing data.
- Required data types, queries and extensions.
- Backup, recovery and monitoring procedures.
- Access permissions and separation between environments.
- Results from a trial with realistic data volume and workload.
Choose around the project
For an existing application, inspect its model, queries and infrastructure first. A slow page does not prove that the database must be replaced. Excessive fetching, a missing index or an inefficient application flow may be responsible.
MSS works with MySQL and PostgreSQL on data models, APIs, optimisation and migrations. We begin with specific operations and the criteria that will be used to assess improvement.