django postgresql中随机取出一条记录的实现
2015-10-15 10:36
543 查看
import random
random_uuid =
''.join([random.choice('0123456789abcdef')
for _ in
range(32)])
采用filter比较uuid算法随机取一条记录
比order_by(
'?'
)[:
1
]方法效率上具有优势
相关文章推荐
- MySQL数据定义语句:CREATE(创建)命令、ALTER(修改)命令、DROP(删除)
- PostgreSQL数据库 OLTP高并发请求性能优化
- Oracle FORALL & PostgreSQL ? op any|all (ARRAY)
- PL/SQL Developer 连接Oracle数据库详细配置方法
- PostgreSQL (User defined Operator) UDO & Operator Optimization Information
- londiste3 copy table' snapshot & PostgreSQL logical replication's snapshot 不同之处
- PostgreSQL & Oracle - 2 OLTP "update/select based primary key" & insert
- PostgreSQL & Oracle -1 OLTP "update/select based primary key" & insert
- population & sample covariance, standard deviation Aggregate in PostgreSQL
- PostgreSQL数据库监控中的统计学 - 对象空间的数据分布图
- MySQL主从架构之Master-Master互为主备
- Django如何连接mysql数据库
- SQL 中GO的作用
- MySQL架构体系
- Oracle学习(五)之 解决pl/sql developer中文乱码
- PostgreSQL实用日常维护SQL
- SqlBulkCopy快速批量上传大量数据到SqlServer
- MySQL Replication 常用架构
- PLSQL Developer使用
- Goldengate之Oracle到Mysql的同步