قراءة EXPLAIN ANALYZE
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
read a plan tree and spot the problem node.
الموضوعات المخطط لها
EXPLAINshows 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) withactual rows=; big gaps point to bad statistics. - Scan types:
Seq Scan,Index Scan,Index Only Scan,Bitmap Heap Scan. ANALYZEreally executes the statement; wrapINSERT/UPDATE/DELETEin a transaction and roll back.
تفاصيل المخطط المبدئي
عرض عملي
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.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.