Cheat sheet · Build products
Choosing the right database cheat sheet
Opens with creditsFor students and developers building apps who need to pick the right database for each job: relational, document, key-value, cache, search, vector, warehouse, graph, time series and object storage. Use the decision chart and the at-a-glance cards to choose quickly, and the cloud tables to find the matching managed service on AWS, Azure and Google Cloud.
Chapters
10 chapters · 78 concepts
1Start from the dataDescribe the data before naming a product: its shape, the questions the app asks, how much there is and how correct it must be. The decision chart turns those answers into a database type.7 concepts
- 1Decision chart: data and access pattern to databaseA quick map from the kind of data and the way it is used to the database type that usually fits.
- 2Structured, semi-structured and unstructured dataStructured data fits rows and columns with known types.
- 3Access patternsThe questions an app asks its data again and again, such as "get user by email" or "last 20 orders for a shop", with a rough idea of how often each runs.
- 4Read-write mix and data sizeWhether an app mostly reads or mostly writes, how many records it will hold after a year and how big each one is.
- 5Consistency needsHow correct data must be at every moment.
- 6ACID transactionsA transaction groups changes so they are atomic (all or nothing), consistent (rules hold), isolated (concurrent transactions do not interfere) and durable…
- 7Questions to ask before choosingA short list answered for every project: data shapes, top access patterns, size after a year, what must be exact, any search, similarity or reporting needs…
7 in this chapterOpen this chapter2Relational databasesPostgreSQL, MySQL, SQLite and SQL Server store related records in tables with keys, constraints and transactions. For most apps one of them is the right default, with JSON columns for the flexible parts.7 concepts
- 1Relational databaseA database that stores data in tables of rows and columns, links tables with keys and is queried with SQL.
- 2PostgreSQL as the defaultPostgreSQL is an open source relational database that also stores and indexes JSON, has built-in full-text search and gains vectors, maps and time series…
- 3MySQL, SQLite and SQL ServerMySQL is common behind websites and PHP apps.
- 4JSON columnsColumns that store JSON inside a relational table.
- 5ConstraintsRules the database enforces on every write: NOT NULL, UNIQUE, CHECK and foreign keys, which make a value refer to an existing row in another table.
- 6Migrations, drivers and ORMsA driver sends queries from your code; an ORM maps tables to objects.
- 7One Postgres is often enoughOne PostgreSQL database with
jsonb, full-text search, pgvector, and TimescaleDB or PostGIS when needed covers relational data, flexible fields, search…
7 in this chapterOpen this chapter- Document databasesMongoDB and Firestore store each record as a JSON-like document. They suit data that varies in shape and is read one whole record at a time.7 conceptsOpens with credits
- Key-value stores and cachingKey-value stores fetch a value by its key very quickly. Redis serves as a cache and for sessions and rate limits; DynamoDB is a durable key-value primary database.8 conceptsOpens with credits
- SearchReal search needs text analysis, an inverted index and relevance ranking. Start with PostgreSQL full-text search and add a search engine when typos, facets or ranking demand it.7 conceptsOpens with credits
- Vector search for AIEmbeddings turn text and images into vectors; vector search finds the nearest ones. pgvector covers most early apps, and dedicated vector databases add features at larger sizes.8 conceptsOpens with credits
- Columnar databases and warehousesReports over millions of rows need columnar storage. Know OLTP from OLAP, and where BigQuery, Snowflake, Redshift, ClickHouse and DuckDB fit.8 conceptsOpens with credits
- Graph, time series and object storageGraph databases follow connections, time-series databases handle readings over time, and object storage holds files. Know when each earns its place.7 conceptsOpens with credits
- Choosing, combining and running itManaged or self-hosted, the matching services on each cloud, free tiers, cost, Firebase versus Supabase and a decision you can explain.10 conceptsOpens with credits
- Each type at a glanceOne card per database type: use it when, avoid it when, example products and managed options. Read with the decision chart.9 conceptsOpens with credits
- 11Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.141 terms
About this sheet
SQL, document, cache, search, vector and more.
Related on Sefism
Picked from the other libraries by shared topics.
Roadmaps
See allBest practices
See all- PostgreSQL Best PracticesDesign, index, query and run PostgreSQL well: data types, constraints, EXPLAIN, zero-downtime migrations, pooling, transactions, backups and roles.
- MongoDB Best PracticesModel, index, query and run MongoDB well: access-pattern schemas, validation, the ESR rule, aggregation limits, write concern, transactions, drivers and security.
- Data Pipeline Best PracticesHow to build data pipelines you can re-run, test and trust: idempotent tasks, orchestrator hygiene, layered transformations, data tests, freshness, ownership and monitoring.
Checklists
See allProject structures
See all- NestJS project structureFor people who want a structured TypeScript backend with clear rules about where code goes. Every feature is a Nest module that owns its controller, service, DTOs, entities and tests, so the app grows by adding folders, not by stretching old ones. The tree follows one orders API from nest new to a codebase a whole team can run for years.
- FastAPI project structureA typed Python API for an orders app, built the way the FastAPI docs and the official full stack template lay it out: one
apppackage, a router per feature, Pydantic schemas at the edges, services in the middle and SQLAlchemy models with Alembic migrations underneath. For students who have finished the FastAPI tutorial and want to know where the second, tenth and fiftieth file go. - Django project structureFor students building their first serious Python web app or API with Django, and for the team that keeps it running years later. The project is a thin "config" package plus one Django app per business area (accounts, catalog, orders, core), each owning its models, services, views, API, migrations and tests. Settings come from validated environment variables, and the tree grows from the tutorial layout to CI, containers, observability and enforced module boundaries.
Career questions
See all- Should I use PostgreSQL or MongoDB for my project?For most student and startup projects, PostgreSQL is the safer default: relational data, joins, constraints and transactions fit most apps, and it handles JSON and vector search too. MongoDB is a good fit when your data is naturally document-shaped and varies a lot, or your team already knows it well. Model your data first, then choose.
- Should I use Firebase or Supabase for my app?Both let you ship an app fast with auth, a database, storage and hosting-style services. Supabase is built on PostgreSQL, so it suits relational data and SQL skills you will reuse anywhere. Firebase is a mature Google platform with a document database and strong mobile tooling. Choose by your data shape, your platform, and how much you want to learn transferable database skills.
- Do I need a vector database for my AI project?Often not. For a student project or a small app, a vector extension on a database you already use (such as pgvector in PostgreSQL), or even an in-memory index, is enough. A dedicated vector database earns its place with very large collections, heavy query traffic, or features like advanced filtering and multi-tenancy at scale.
Cheat sheets
See allStuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
- 1:1 Mentorship
- Fresh Graduate Mentorship
- Career Guidance
Brand deals, promos and partnerships: tauseeffayyaz@gmail.com