كيف يعمل فهرس B-tree
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
explain why a B-tree finds rows in a few page reads.
الموضوعات المخطط لها
- A B-tree is a balanced tree of sorted pages: root, internal pages, leaf pages that point to table rows (heap tuples).
- A lookup descends only 3–4 levels even for millions of rows.
- Sorted leaves make equality, range, and
ORDER BYfast. - It cannot help with
LIKE '%abc'or with a function wrapped around the column. - Pages are 8 kB and hold many entries, so the tree stays shallow.
تفاصيل المخطط المبدئي
عرض عملي
a diagram of a root, two internal pages, and leaf pages with customer_id values; trace a lookup of 4711. Optionally inspect tree height with the pageinspect extension (verify availability before recording).
اختبر فهمك
Why does an index lookup on 10 M rows need only a few page reads?
أظهر الإجابة
The tree is shallow and wide.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.