I have a django model that looks like this:
class SomeModel(Model):
some_field = CharField(max_length=10)
large_data = JsonField(blank=True, null=True)
the "large_data" field can get really large, like 150mb. I know this is really bad practice, most of the data could decoupled into other sql database tables, but this is legacy application and the impact of the rework would be huge.
It turns out that any query to this table is really slow, sometimes I just want to modify the "some_field" value, but even when I save that field individually like in the code below, the update query takes ages
obj.some_field = "ice cream"
obj.save(update_fields=["some_field"])
I am sure the large_data is the guilty because if I set its value to "None" then the save operation is committed right away.
Are there optimization tricks that can be applied to my example without reworking the json field?
Thanks in advance