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

قراءة EXPLAIN ANALYZE

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

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

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

في هذا الدرس

read a plan tree and spot the problem node.

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

  • EXPLAIN shows the estimated plan; EXPLAIN (ANALYZE, BUFFERS) runs the query and adds actual rows, time, and page reads.
  • Read inner-most, most-indented nodes first; time is per loop, multiply by loops.
  • Compare rows= (estimate) with actual rows=; big gaps point to bad statistics.
  • Scan types: Seq Scan, Index Scan, Index Only Scan, Bitmap Heap Scan.
  • ANALYZE really executes the statement; wrap INSERT/UPDATE/DELETE in a transaction and roll back.
تفاصيل المخطط المبدئي

عرض عملي

sql
EXPLAIN (ANALYZE, BUFFERS)
SELECT * FROM orders WHERE customer_id = 4711 ORDER BY created_at DESC LIMIT 20;

Annotate node type, estimated vs actual rows, Buffers: shared hit/read, and execution time.

اختبر فهمك

Why is plain EXPLAIN not enough to find a slow node?

أظهر الإجابة

It shows only estimates, not actual rows or time.

التطبيق

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

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

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

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