improve entezar bazdid

This commit is contained in:
javad committed 2026-10-20 19:02:34 +03:30
1 parent 1fd27d0445
commit 2aee85593f
18 files changed
+10271 -7558

No files matched your search

+16
View File
@@ -66,3 +66,19 @@ class Action(models.Model):
nextNazarDT = models.DateTimeField(null=True, blank=True, default=None)
nazarDT = models.DateTimeField(null=True, blank=True, default=None)
grade = models.IntegerField(null=True, blank=True, default=None)
class Meta:
# ایندکس **پوشا (covering)** برای محاسبهٔ «آخرین بازدید»: هر سه ستونِ لازم
# برای فیلتر و تجمیع داخل خودِ ایندکس است، پس دیتابیس به جدول اصلی مراجعه
# نمی‌کند. اندازه‌گیری روی دادهٔ واقعی: ۱۶۴ms → ۲۹ms.
# ستون‌های actionType/status/customer_id برای فیلتر و group، و دو ستون
# تاریخ برای محاسبهٔ «تاریخ مؤثر» در همان ایندکس.
indexes = [
models.Index(
fields=[
'actionType', 'status', 'customer_id',
'actionDateTime', 'finishDateTime',
],
name='act_visit_idx',
),
]