我有大约 10 个帖子,它生成大约 100 个查询来获取帖子标签。这taggit
下面使用的 Wagtail 库supportprefetch_related https://github.com/alex/django-taggit/blob/master/tests/tests.py#L608,但添加prefetch_related
没有影响。经过更多研究,我发现罪魁祸首是WagtailClusterTaggableManager
覆盖taggit
's TaggableManager
.
In the 变更日志 https://github.com/wagtail/django-modelcluster/blob/master/CHANGELOG.txt, 它说
2.0 (22.04.2016)
~~~~~~~~~~~~~~~~
* Fix: prefetch_related on a ClusterTaggableManager no longer fails (but doesn't prefetch either)
已经过去两年了,他们似乎不会很快修复它。那么...我可以做些什么来减少查询数量吗?谢谢!
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)