Попытка оптимизации #3 (Индексы)
This commit is contained in:
parent
bae2125269
commit
7912998c94
37
apps/gto/migrations/0023_auto_20250606_1100.py
Normal file
37
apps/gto/migrations/0023_auto_20250606_1100.py
Normal file
@ -0,0 +1,37 @@
|
||||
# Generated by Django 3.2.25 on 2025-06-06 11:00
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('gto', '0022_auto_20250606_1015'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveIndex(
|
||||
model_name='equipment',
|
||||
name='gto_equipme_time_91d62e_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='equipment',
|
||||
name='gto_equipme_block_328df7_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='equipmenttracking',
|
||||
name='gto_equipme_equipme_490e56_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='equipmenttracking',
|
||||
name='gto_equipme_time_e9a7cd_idx',
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='equipment',
|
||||
index=models.Index(fields=['time'], name='gto_equipme_time_f2ed8b_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='equipmenttracking',
|
||||
index=models.Index(fields=['time'], name='gto_equipme_time_ffb373_idx'),
|
||||
),
|
||||
]
|
||||
@ -107,9 +107,8 @@ class Equipment(models.Model): # Оборудование
|
||||
verbose_name = "объект"
|
||||
verbose_name_plural = "объекты"
|
||||
indexes = [
|
||||
models.Index(fields=["uid", ]),
|
||||
models.Index(fields=["name", ]),
|
||||
models.Index(fields=["-time", ]),
|
||||
models.Index(fields=["block", "-time"]),
|
||||
models.Index(fields=["uid"]),
|
||||
models.Index(fields=["name"]),
|
||||
models.Index(fields=["time"]),
|
||||
models.Index(fields=["block", "time"]),
|
||||
]
|
||||
|
||||
@ -63,7 +63,6 @@ class EquipmentTracking(models.Model): # Передвижение оборуд
|
||||
verbose_name_plural = "Передвижение оборудования"
|
||||
indexes = [
|
||||
models.Index(fields=["eventid"]),
|
||||
models.Index(fields=["equipment", "-time"]),
|
||||
models.Index(fields=["-time"]),
|
||||
models.Index(fields=["time"]),
|
||||
models.Index(fields=["equipment", "time"]),
|
||||
]
|
||||
|
||||
77
apps/workerslocation/migrations/0015_auto_20250606_1100.py
Normal file
77
apps/workerslocation/migrations/0015_auto_20250606_1100.py
Normal file
@ -0,0 +1,77 @@
|
||||
# Generated by Django 3.2.25 on 2025-06-06 11:00
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('workerslocation', '0014_auto_20250606_0959'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerslocation',
|
||||
name='uid_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerslocation',
|
||||
name='name_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerslocation',
|
||||
name='neg_update_time_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerslocation',
|
||||
name='active_neg_update_time_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerslocation',
|
||||
name='active_update_icon_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerstracking',
|
||||
name='workersloca_worker__c2007b_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerstracking',
|
||||
name='workersloca_time_4b870c_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerstracking',
|
||||
name='worker_time_idx',
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerslocation',
|
||||
index=models.Index(fields=['uid'], name='workersloca_uid_cbf84d_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerslocation',
|
||||
index=models.Index(fields=['name'], name='workersloca_name_cc95e1_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerslocation',
|
||||
index=models.Index(fields=['active'], name='workersloca_active_a8a207_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerslocation',
|
||||
index=models.Index(fields=['active', 'update_time'], name='workersloca_active_c3b753_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerslocation',
|
||||
index=models.Index(fields=['icon'], name='workersloca_icon_id_a97339_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerstracking',
|
||||
index=models.Index(fields=['worker'], name='workersloca_worker__d7aec1_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerstracking',
|
||||
index=models.Index(fields=['time'], name='workersloca_time_9a1c92_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerstracking',
|
||||
index=models.Index(fields=['worker', 'time'], name='workersloca_worker__f6ee2a_idx'),
|
||||
),
|
||||
]
|
||||
29
apps/workerslocation/migrations/0016_auto_20250606_1104.py
Normal file
29
apps/workerslocation/migrations/0016_auto_20250606_1104.py
Normal file
@ -0,0 +1,29 @@
|
||||
# Generated by Django 3.2.25 on 2025-06-06 11:04
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('workerslocation', '0015_auto_20250606_1100'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerslocation',
|
||||
name='workersloca_active_c3b753_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='workerstracking',
|
||||
name='workersloca_worker__f6ee2a_idx',
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerslocation',
|
||||
index=models.Index(fields=['update_time', 'active'], name='workersloca_update__4a6860_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='workerstracking',
|
||||
index=models.Index(fields=['time', 'worker'], name='workersloca_time_83493b_idx'),
|
||||
),
|
||||
]
|
||||
@ -83,9 +83,9 @@ class WorkersLocation(models.Model):
|
||||
verbose_name = "объект"
|
||||
verbose_name_plural = "объекты"
|
||||
indexes = [
|
||||
models.Index(fields=["uid"], name="uid_idx"),
|
||||
models.Index(fields=["name"], name="name_idx"),
|
||||
models.Index(fields=["-update_time"], name="neg_update_time_idx"),
|
||||
models.Index(fields=["active", "-update_time"], name="active_neg_update_time_idx"),
|
||||
models.Index(fields=["active", "update_time", "icon"], name="active_update_icon_idx"),
|
||||
models.Index(fields=["uid"]),
|
||||
models.Index(fields=["name"]),
|
||||
models.Index(fields=["active"]),
|
||||
models.Index(fields=["update_time", "active"]),
|
||||
models.Index(fields=["icon"]),
|
||||
]
|
||||
|
||||
@ -59,7 +59,7 @@ class WorkersTracking(models.Model): # Передвижение персона
|
||||
verbose_name = "Передвижение сотрудника"
|
||||
verbose_name_plural = "Передвижения сотрудников"
|
||||
indexes = [
|
||||
models.Index(fields=["worker", "-time"]),
|
||||
models.Index(fields=["-time",]),
|
||||
models.Index(fields=["worker", "time"], name="worker_time_idx"),
|
||||
models.Index(fields=["worker"]),
|
||||
models.Index(fields=["time",]),
|
||||
models.Index(fields=["time","worker"]),
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user