⬅︎ Back to Optimization of getting random rows out of a PostgreSQL in Django
Are you sure you're doing that right? I just tried it myself and got this:COUNT 84482using_max() took 0.613966941833 secondsusing_max2() took 2.08254098892 secondsusing_count_and_slice() took 14.112842083 secondsCode here: http://www.peterbe.com/plog/getting-random-rows-postgresql-django/get_random_ones.py
no need, now that i've filled up the database with faked data, we get this: 0.862994 seconds 0.104061 seconds 0.894336 seconds 0.114008 seconds 0.809722 seconds 0.102276 seconds
no, i think the numbers jive, and you're right.it seems to be a 7x factor using the count/slice method i was talking about.
Don't think so, out of the 14 seconds about 0.4 seconds is spent getting the counts.
Comment
Are you sure you're doing that right? I just tried it myself and got this:
COUNT 84482
using_max() took 0.613966941833 seconds
using_max2() took 2.08254098892 seconds
using_count_and_slice() took 14.112842083 seconds
Code here: http://www.peterbe.com/plog/getting-random-rows-postgresql-django/get_random_ones.py
Parent comment
no need, now that i've filled up the database with faked data, we get this: 0.862994 seconds 0.104061 seconds 0.894336 seconds 0.114008 seconds 0.809722 seconds 0.102276 seconds
Replies
no, i think the numbers jive, and you're right.
it seems to be a 7x factor using the count/slice method i was talking about.
Don't think so, out of the 14 seconds about 0.4 seconds is spent getting the counts.