[SQL] Pick random rows from SELECT?

Gilles Ganault nospam at nospam.com
Wed Sep 23 14:04:18 EDT 2009


On Mon, 21 Sep 2009 21:40:02 -0700, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
>	I'd suggest either a pool of threads -- 5-10, each reading company
>names from a shared QUEUE, which is populated by the main thread
>(remember to commit() so that you don't block on database updates by the
>threads). OR... determine how many companies there are, and start
>threads feeding them <start> and <length> (length being #names /
>#threads, round up -- start then being 0*length+1, 1*length+1, etc...)
>and use those in thread specific selects using "... limit <length>
>offset <start>"... This way each thread retrieves its own limited set of
>companies (make sure to use the same sorting criteria).

Thanks for the help :)



More information about the Python-list mailing list