问题描述
我有很多行的Profile表。我试图基于super_category
和account_id
(这些是模型Profile中的字段)过滤出Profile。
假设我有一个bulk_account_ids
和super_categories
list_of_ids = Profile.objects.filter(account_id__in=bulk_account_ids,super_category__in=super_categories).values_list('id',flat=True))
list_of_ids = list(list_of_ids)
SoMetask.delay(ids=list_of_ids)
此特定查询在第二行进行评估时超时。
我可以在查询末尾使用.iterator()
来对此进行优化吗?
即list(list_of_ids.iterator())
,如果没有,我还能做什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)