0Pricing
Firebase Auth & Realtime Database Apps · 강의

비정규화 및 데이터 중복 전략

데이터를 의도적으로 중복하고 조인보다 비정규화된 구조를 선택하며 쓰기 시점에 복사본의 일관성을 유지하여 빠른 읽기에 적합한 Realtime Database 데이터를 모델링합니다.

비정규화 및 데이터 중복 전략은(는) CoddyKit의 무료 Firebase Auth & Realtime Database Apps 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Firebase Auth & Realtime Database Apps 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Firebase Auth & Realtime Database Apps 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

NoSQL Thinking

Realtime Database has no joins. Instead of normalizing data like a relational schema, you shape data around how you read it. This often means storing the same value in more than one place.

This deliberate redundancy is called denormalization.

The Cost of Joins

In a normalized model, showing a post with its author name would require reading the post, then reading the user node separately for every post. That is many round-trips and slow lists.

Duplicating for Reads

Instead, copy the small bits you display alongside the post. Now one read renders the whole feed item.

{
  "posts": {
    "p1": {
      "text": "Hello",
      "authorId": "u9",
      "authorName": "Alice",
      "authorAvatar": "a9.png"
    }
  }
}

What to Duplicate

Duplicate only the fields you actually display in lists, not entire records.

  • Names, avatars, titles: good candidates
  • Large or sensitive fields: keep them in one place
  • Rarely-changing data: safest to copy

The Consistency Trade-Off

The cost of duplication is keeping copies in sync. If Alice renames herself, every copy of authorName must update. You trade write complexity for read speed.

Multi-Path Updates Keep Copies in Sync

Update all copies atomically with a single multi-path write so no copy is left stale.

import { getDatabase, ref, update } from 'firebase/database';

const updates = {};
updates['/users/u9/name'] = 'Alice B.';
updates['/posts/p1/authorName'] = 'Alice B.';
await update(ref(getDatabase()), updates);

Index Tables

Another denormalization pattern is the index node: a lookup mapping that lets you find related items without scanning. Here we map a user to their post IDs.

{
  "userPosts": {
    "u9": { "p1": true, "p7": true }
  }
}

Avoiding Deep Nesting

Reading a node downloads everything beneath it. Keep your tree shallow so a read does not pull in unrelated children. Split large nested structures into sibling top-level nodes.

When NOT to Denormalize

Denormalization is not always right. Avoid it when:

  • The duplicated field changes very frequently
  • There are many copies to keep consistent
  • The data is large or rarely read together

In those cases, store once and read separately.

Validating Duplicated Data

Use Security Rules .validate to keep duplicated fields trustworthy, for example ensuring an authorName copy is always a non-empty string.

{
  "posts": {
    "$id": {
      "authorName": { ".validate": "newData.isString() && newData.val().length > 0" }
    }
  }
}

Designing for Your Queries

The golden rule: structure data around your most common reads. Write the queries your app needs first, then shape (and duplicate) data so each one is a single, shallow read.

Quick Check

Test your understanding of denormalization.

Recap

You can now model NoSQL data for speed.

  • Denormalize by duplicating displayed fields
  • Keep copies in sync with multi-path updates
  • Use index nodes for relationships
  • Keep the tree shallow to avoid over-fetching
  • Structure data around your common queries

자주 묻는 질문

“비정규화 및 데이터 중복 전략” 강의는 무료인가요?

네 — “비정규화 및 데이터 중복 전략” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Firebase Auth & Realtime Database Apps 강의 전체를 잠금 해제할 수 있습니다. Firebase Auth & Realtime Database Apps 강의에는 총 4개의 강의가 포함되어 있습니다.

“비정규화 및 데이터 중복 전략”에서 뭘 배우나요?

데이터를 의도적으로 중복하고 조인보다 비정규화된 구조를 선택하며 쓰기 시점에 복사본의 일관성을 유지하여 빠른 읽기에 적합한 Realtime Database 데이터를 모델링합니다. 브라우저에서 직접 실행하는 실습 코드로 Firebase Auth & Realtime Database Apps을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Firebase Auth & Realtime Database Apps을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Firebase Auth & Realtime Database Apps은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“비정규화 및 데이터 중복 전략” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Firebase Auth & Realtime Database Apps 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Firebase Auth & Realtime Database Apps 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 팬아웃 데이터 업데이트
  2. 트랜잭션 데이터 작업
  3. 원자적 카운터 및 큐
  4. 비정규화 및 데이터 중복 전략
← Firebase Auth & Realtime Database Apps(으)로 돌아가기