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

Vacuum وautovacuum

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

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

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

في هذا الدرس

explain what vacuum does and why to keep autovacuum on.

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

  • An UPDATE writes a new row version and marks the old one dead; DELETE marks it dead.
  • VACUUM marks dead versions reusable, updates the visibility map, and freezes old transaction ids.
  • Autovacuum runs it automatically when enough rows change; tune per table for hot tables.
  • Plain VACUUM does not shrink the file; VACUUM FULL does but takes an exclusive lock.
  • Never disable autovacuum; fix its settings instead.
تفاصيل المخطط المبدئي

عرض عملي

SELECT relname, n_dead_tup, last_autovacuum FROM pg_stat_user_tables ORDER BY n_dead_tup DESC;

اختبر فهمك

Why does an UPDATE need vacuum later?

أظهر الإجابة

It leaves the old row version behind as a dead tuple.

التطبيق

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

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

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

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