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

عرض عملي: تحديثات جماعية أسرع 10 مرات بالدفعات

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

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

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

في هذا الدرس

speed up the nightly price update without leaving JPA.

تفاصيل المخطط المبدئي

خطوة بخطوة

  1. Baseline: load 100 000 products, change the price, saveAll; record statement count and time with statistics.
  2. Enable batch_size=50 and order_updates; measure again.
  3. Page through the data and flush() + clear() every 50 rows to keep memory stable.
  4. Planned mistake: batching is set but entities use IDENTITY and the job inserts; inserts stay unbatched. Fix: switch to a sequence for insert jobs (updates are not affected by IDENTITY).
  5. Compare final statement counts and elapsed time (target about 10× faster).
  6. Mention the alternative of one set-based UPDATE statement when entity logic is not needed.

Prepares MID-021-LAB1.

اختبر فهمك

What was the statement count change after batching?

أظهر الإجابة

Many single-row statements became far fewer batched executions.

التطبيق

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

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

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

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