On Sun, Mar 29, 2009 at 10:24 AM, marcin mank <marcin.mank@xxxxxxxxx> wrote: > I think (a part of) Your problem is that order by random() is O(N > logN) complexity, while You are after O(N) . > > The solution (in pseudocode) > [snip] OK, I may be guiding You the wrong way select g,g,g,g from generate_series(1,25000000) as g order by random() limit 10 executes in under thirty seconds, so I don`t think the sort is a problem. Greetings Marcin -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general