Schema
The planned shape of data: fields, types, relationships and constraints that keep records meaningful.
Choose storage by the shape of your data and the questions your product needs to answer.
Every useful web application needs a reliable place to store state. User accounts, tasks, products and payments should survive a page refresh and remain consistent when multiple requests arrive at once. A database is the durable memory behind that experience.
The planned shape of data: fields, types, relationships and constraints that keep records meaningful.
An instruction that reads or changes records. Good queries match the way the product actually loads data.
A lookup structure that speeds up common filters and sorts, with extra storage and write cost.
A group of changes that succeeds together or rolls back together, protecting consistency.
PostgreSQL and other SQL databases store data in related tables. A defined schema, relationships and transactions make them a strong choice for orders, accounts, payments and other structured records.
For example, an order can reference a customer and several product rows. Foreign keys preserve those relationships, while a transaction ensures the order and its line items are saved together.
MongoDB and similar systems store flexible documents. They can work well when records have changing fields or when an application naturally reads a whole document at once.
Flexibility is useful, but it does not remove the need for design. Decide which data belongs together, validate required fields and avoid duplicating values that must stay synchronized in many documents.
Design indexes around real queries, validate data at the API boundary, keep secrets in environment variables and back up production data. Start with a clear schema; complexity is easier to add than to remove.
These habits keep the data layer predictable as the product grows. The best database is the one whose structure makes the most important product questions easy to answer.