Coderwall
Ruby Python JavaScript Front-End Tools iOS
More Tips
Ruby Python JavaScript Front-End Tools iOS PHP Android .NET Java Jobs
Jobs
Sign In or Up
Last Updated: February 25, 2016
·
1.831K
· geeknam

Django order_by random in Postgres

#python
#sql
#django
#postgres

Do NOT use order_by('?') if your table size is big.

Entry.objects.order_by('?')

More about this:
http://www.peterbe.com/plog/getting-random-rows-postgresql-django

#python
#sql
#django
#postgres

Written by Nam Ngo

Recommend
Say Thanks
Update Notifications Off
Respond

Related protips

Flatten a list of lists in one line in Python

342.4K
14

Remote Access to IPython Notebooks via SSH

304.2K
24

Emulate do-while loop in Python

253.9K
5

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Best #Python Authors
terrasea
341.7K
#python
#Dart
#Java
cheglastgnat
303.7K
#python
#shell
#c++
projectcleverweb
291.6K
#python
#javascript
#css
saji89
253.8K
#python
#mantis
#linux
lotia
207.2K
#python
#Open Source
#Shell
Related Tags
#python
#sql
#django
#postgres
Awesome Job
See All Jobs

Post a job for only $299
Thanks to our sponsor
@coderwall
APM product comparisons Contact Privacy Terms

Copyright 2025

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.