انتقل إلى المحتوى
أمين أبوزيد
MID-041

أساسيات NoSQL

  • 6 درس
  • 1.5 ساعة تدريب (تقدير)
في هذه الصفحة 8 موضوعات

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

نظرة عامة

الموضوعات

  • المفتاح والقيمة (Key-value)
  • المستندات (document)
  • العائلة العمودية (column-family)
  • قواعد بيانات الرسم البياني (graph)

تعلّم أولًا

1.5 ساعة تدريب (تقدير)

مخرجات التعلم

  1. Describe key-value, document, wide-column, and graph models with a fitting use case for each.
  2. Explain query-driven data modeling and its trade-off against flexible querying.
  3. Relate each store's consistency and scaling model to the CAP/PACELC discussion.

الدروس

  1. 01لماذا وُجد NoSQL
  2. 02مخازن المفتاح والقيمة والمستندات
  3. 03المخازن العمودية العريضة
  4. 04قواعد بيانات الرسم البياني
  5. 05النمذجة وفق الاستعلامات
  6. 06عرض عملي: البيانات نفسها في أربعة نماذج

المختبر والتمارين

Lab

MID-041-LAB1 · Model comparison

Outcomes: 1–3 · Time: ~1.5 h Model Shop's reviews (rating, text, product, customer, date) in a document, a wide-column, and a relational form. For each model list the queries it supports well, those it supports badly, and its consistency and scaling behavior. Acceptance: comparison table covering at least five queries across the three models.

Exercises (assessment: quiz)

IDOutcomeTask
MID-041-EX011Match each use case to a model: session lookup, product with varying attributes, time-series sensor writes, "friends of friends".
MID-041-EX021Give one Shop feature fitting each of key-value, document, wide-column, and graph.
MID-041-EX032List three queries for order history, then design a wide-column table for each.
MID-041-EX042Explain what you give up when you model for queries only.
MID-041-EX053State, for a Cassandra-like store and a single-node PostgreSQL, the side each takes in CAP and what PACELC adds.
أظهر الحلول
  • EX01 Session: key-value. Varying attributes: document. Time series: wide-column. Friends of friends: graph.
  • EX02 Key-value: sessions/cart cache. Document: reviews/product attributes. Wide-column: activity/event log. Graph: "also bought" recommendations.
  • EX03 E.g. orders_by_customer(customer_id, placed_at, order_id), orders_by_status(status, placed_at, order_id) (watch partition size), order_by_id(order_id). Each table answers one query.
  • EX04 Ad hoc and new queries need new tables or a redesign; data is duplicated, so updates touch several places.
  • EX05 Cassandra-like: tunable, commonly leans to availability (AP) in a partition and low latency otherwise. Single-node PostgreSQL: no partition within one node; consistency is strong. PACELC: in the normal case, trade latency against consistency. Verify settings per product.

Outcomes 1-3 are also checked by the quiz and the lab table.

الاختبار

Outcomes: O1 the four models · O2 query-driven modeling · O3 consistency and scaling.

اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.

  1. 1Best fit for "customers who bought X also bought":O1
  2. 2A document store is best when:O1
  3. 3A key-value store lookup is by:O1
  4. 4Wide-column stores are designed around:O1
  5. 5Query-driven modeling means:O2
  6. 6A trade-off of query-driven modeling:O2
  7. 7"Schemaless" really means:O2
  8. 8CAP says during a network partition you choose between:O3
  9. 9PACELC adds that, without a partition, you still trade:O3
  10. 10Why do many wide-column stores scale writes well?O3

الجزء العملي

Lab MID-041-LAB1 (comparison table of reviews in three models). Pass: quiz at least 8/10 and a lab table with at least five queries.

أخطاء شائعة

"schemaless" meaning "no schema design".

التقييم

Quiz.

الصلة بالمسار الوظيفي

Data selection (MID-044) and database architecture (ARC-016).

اكتب للبحث في المستويات والمراحل والوحدات والدروس.