
Almost every application needs somewhere to keep its data, and one of the first decisions you face is whether to use a SQL (relational) database or a NoSQL one. The choice affects how you model data, how you query it, how the system grows and how much work your team does to keep it correct. The right answer depends on the shape of your data, the questions you ask of it and the guarantees you need.
The relational model was described by Edgar F. Codd at IBM in 1970. IBM researchers then built the language that became SQL, and the first commercial relational databases, such as Oracle, appeared at the end of the 1970s. SQL was standardised in 1986 and has dominated business software ever since. In the 2000s, web companies such as Google and Amazon needed to spread enormous amounts of data across many cheap servers, and their published designs, Bigtable and Dynamo, inspired a wave of new systems. The label "NoSQL" became popular around 2009, when MongoDB, Cassandra and Redis were gaining attention. Today the line is blurrier: many SQL databases store JSON, and many NoSQL databases support transactions.
A relational database such as PostgreSQL, MySQL, SQL Server or SQLite stores data in tables of rows and columns with a fixed schema. Tables are linked by keys, so a customer row can be connected to many order rows without copying the customer's details.
"NoSQL" is not one technology but several, each built around a different data shape:
Choose a relational database when your data is structured and its parts are closely related: customers, orders, invoices, bookings, inventory. It is also the safer default when correctness matters more than raw speed, when you need reports and ad hoc analysis, or when you cannot yet predict every question you will ask. A single well-tuned PostgreSQL server can handle far more traffic than most projects will ever see, and read replicas and partitioning help it grow further.
NoSQL shines when one of its strengths matches a real need. Pick a document store when records vary a lot or are naturally read and written as a whole, such as product catalogues or content management. Pick a key-value store when you need very fast lookups by a known key. Pick a wide-column store when you must write massive amounts of data across several data centres with high availability. Pick a graph database when the relationships themselves are the main thing you query. Remember that most NoSQL systems ask you to design around your access patterns: you decide in advance which queries must be fast and shape the data for them.
Many modern systems combine databases, an approach called polyglot persistence: PostgreSQL for orders and accounts, Redis for caching and sessions, a search engine for full-text search. PostgreSQL's JSONB type lets you store and index flexible documents inside a relational table, MongoDB has supported multi-document ACID transactions since 2018, and distributed SQL databases such as CockroachDB and Google Spanner offer SQL with horizontal scaling. If you are unsure, start with a relational database, learn your real access patterns, and add a specialised store only when a clear need appears. Whichever you choose, handle personal data in line with privacy laws such as the GDPR.
Grade 10 Math: Functions and Reasoning - Quiz
1170 questions