学习笔记——Django项目中的结果集、分页

Python85

2022-10-01

结果集的含义:

结果集就是在查询过程中,返回的一个列表的集合。

常见的结果集在一些函数中查询会返回,具体包括的函数有:

filter、exclude、order_by

结果集的两大特性:

(1)惰性

指的是查询时,如果不用则在mysql日志中不会有查询记录。反之,如果使用(一般是输出)的话,就会在记录日志中有记录。

(2)缓存

当查询的结果集被赋给一个变量时,当该变量被多次使用时,日志中有一个缓存,即初始结果集只有一条记录。

[En]

When the result set of a query is assigned to a variable, when the variable is used multiple times, there is a cache in the log, that is, the initial result set has only one record.

输入验证码查看隐藏内容

扫描二维码关注本站微信公众号 Johngo学长
或者在微信里搜索 Johngo学长
回复 svip 获取验证码
wechat Johngo学长