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

كيف يفكّر المخطِّط (Planner)

  • الدرس 1 من 8
  • Mid-level
في هذا الدرس 4 موضوعات

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

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

في هذا الدرس

explain how PostgreSQL picks a plan.

الموضوعات المخطط لها

  • The planner estimates the cost of many possible plans and picks the cheapest estimate.
  • Costs come from table statistics and settings such as random_page_cost.
  • Selectivity is the fraction of rows a condition keeps; low selectivity (many rows) favours a sequential scan.
  • A sequential scan is correct when you need a large share of the table; an index is not always better.
  • The plan is only as good as its estimates.
تفاصيل المخطط المبدئي

عرض عملي

a diagram: SQL, parse, rewrite, plan (candidates with costs), execute. Show WHERE status = 'PAID' on a table where 90% of rows are paid, and why the planner scans.

اختبر فهمك

Why can the planner prefer a sequential scan even when an index exists?

أظهر الإجابة

The condition matches so many rows that reading the index plus the heap costs more.

التطبيق

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

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

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

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