Skip to main content

32 docs tagged with "database"

View all tags

Backend

A hub for the domain that collects notes on server-side development, including API design, authentication, and databases. It covers business logic design, data persistence, and building APIs.

Chapter 18: Database Normalization Exercises

A collection of exercises to deepen the understanding of normalization covered in Chapter 11. Practice decomposing an unnormalized table up through third normal form, repeatedly, using common business cases (children's information, multiple categories, derived values, employee information).

Design Template Collection — Database Design Guide

A collection of design templates and checklists that junior engineers can bring into real projects. It lists out naming conventions, normalization, key design, and review criteria, so you have something to check against right away on a new project.

Domain Model and Table Design — Mapping and Indexes

Covers why to design domain-model-first, mapping patterns under the premise that the domain model and tables are not 1:1 (embedding / one aggregate across multiple tables / technical splitting), how the repository absorbs the gap, and index design including the leftmost-prefix rule for composite indexes and its trade-offs.

Glossary — Database Design Guide

A quick-reference dictionary of the technical terms that appear throughout this guide. When you're reading a chapter and wondering "what was the definition of that term again?", check here for a quick answer.

Transaction Management — Where to Place the Consistency Boundary

Explains transaction management using Laravel's DB::transaction(). Covers the ACID properties, when to place transactions inside the Repository (single aggregate) versus the UseCase (multiple aggregates), nested transactions (savepoints), and the implementation and use cases of optimistic and pessimistic locking.

インデックス — 検索を速くする代償

インデックスが検索を速くする仕組みと、その代わりに払う更新時のコストを解説します。複合インデックスのカラム順序、インデックスが効かない書き方、シャーディングやハッシングとの用語の区別を扱います。

サブクエリとウィンドウ関数 — 行をまたいで数える

サブクエリを置ける 3 つの位置、相関サブクエリと EXISTS、CTE で読む順に書く方法、そしてウィンドウ関数が行を畳まずに集計する仕組みを扱います。ROW_NUMBER と RANK の違い、累計、グループごとの上位 N 件の出し方と、各データベースの対応バージョンを示します。

データの分散 — 増えた先で何が崩れるか

レプリケーションとシャーディングで何が得られ、何が崩れるかを扱います。同期と非同期の違い、書いた直後に読めない理由、分割キーの偏り、結果整合性が見える瞬間、そして CAP 定理を「分断が起きたとき何を諦めるか」として読む方法を示します。

トランザクション — ACID とコミット・ロールバック

トランザクションの基本操作 (開始・コミット・ロールバック) と ACID の 4 特性を解説します。ロールバックが取り消す範囲が自分のトランザクションに限られること、コミット後は取り消せないこと、構文エラーが発生するタイミングを扱います。

ロックと分離レベル — 同時実行の制御

共有ロックと排他ロック、4 つのトランザクション分離レベルと 3 つの読み取り異常、楽観ロックと悲観ロックの使い分け、デッドロックの原因と回避方法を解説します。分離レベルを上げてもロック無しでは競合が防げない理由を扱います。

結合と集計 — 複数の表から 1 つの答えを作る

複数のテーブルを結合して集計するときの読み書きを扱います。SELECT の評価順序、内部結合と外部結合の違いを行の増減で捉える見方、1 対多で親の行が増えること、GROUP BY の粒度、COUNT(*) と COUNT(列) の違い、NULL の三値論理と「件数が合わない」ときの切り分けを扱います。