الإحصائيات والتقديرات
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
explain where estimates come from and how to improve them.
الموضوعات المخطط لها
ANALYZEsamples each column intopg_stats: null fraction, distinct count, most common values, histogram.- Autovacuum runs analyze automatically, but after bulk loads run it by hand.
- Columns that are correlated (city and postcode) are assumed independent; fix with
CREATE STATISTICS. - Raise precision for skewed columns with
ALTER TABLE ... ALTER COLUMN ... SET STATISTICS n.
تفاصيل المخطط المبدئي
عرض عملي
SELECT most_common_vals, most_common_freqs, n_distinct FROM pg_stats
WHERE tablename = 'orders' AND attname = 'status';اختبر فهمك
What do you run after loading 10 M rows so the planner has good estimates?
أظهر الإجابة
ANALYZE on the table.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.