انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-019-L06

عرض عملي: تقسيم سجل الطلبات حسب الشهر

  • الدرس 6 من 6
  • Mid-level
في هذا الدرس 3 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

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

في هذا الدرس

convert the order history to monthly partitions and observe pruning.

تفاصيل المخطط المبدئي

خطوة بخطوة

  1. Show the unpartitioned 10 M-row orders and the plan for a one-month query (large index or sequential scan).
  2. Create the partitioned table orders_p with a composite primary key and monthly partitions plus a default partition.
  3. Copy data in batches and add indexes; swap names in a short transaction.
  4. Run the one-month query: EXPLAIN shows only one partition scanned (pruning).
  5. Planned mistake: filter with a function on created_at, so pruning does not happen. Fix: use a direct range.
  6. DETACH PARTITION orders_2025_01 and archive; compare with the old bulk DELETE.

Prepares MID-019-LAB1.

اختبر فهمك

What shows pruning in the plan?

أظهر الإجابة

Only the matching partitions appear as scan nodes.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

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

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

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