Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我现在需要从数据库中获取特定字段的所有行,我正在使用
mygame.objects.all()
获取所有字段说
x ,y , z 等等
依此类推,但我只需要选择
x 和 y 所以数据库的负载会减少,性能可以提高 请建议我该怎么做
您可以使用:-
mygame.objects.all().only('x','y')
这可能会有所帮助:-
如何限制 Django 查询返回的列?