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

الفهارس الجزئية والشاملة

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

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

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

في هذا الدرس

shrink indexes and avoid table visits.

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

  • Partial index: a WHERE clause on the index so it holds only the rows you query (for example, open orders).
  • The query must imply the index predicate to use it.
  • Covering index: INCLUDE (cols) stores extra columns in the leaf so the query can read only the index.
  • An index-only scan also needs the visibility map to be current, so vacuum matters (see MID-014).
تفاصيل المخطط المبدئي

عرض عملي

sql
CREATE INDEX idx_orders_open ON orders (created_at) WHERE status = 'OPEN';
CREATE INDEX idx_orders_cust_cov ON orders (customer_id) INCLUDE (total_cents);

اختبر فهمك

What must be true for an index-only scan to avoid heap visits?

أظهر الإجابة

All needed columns are in the index and the pages are marked all-visible.

التطبيق

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

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

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

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