The model contains a jsonfield:
class MyModel(Model):
test_result = JSONField()
the data to be handled is dynamic, {'test1':100,'test2':95,'test9':80,...} , { 'test2':60, 'test3':80,'test6':70,... } ...
I want to find all the test results of 'test2' and save them into a list.
all_score_of_test2 =[x.test_result['test2'] for x in MyModel.objects.filter(test_result__has_keys=['test2'])]
it works but the performance is not good. Is there any faster way to do the task? I am using postgresql13.1