Search Postgresql Archives

Re: Selecting K random rows - efficiently!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Another way to look at the problem is: How do I sample a subset of size K efficiently? A query like

   SAMPLE 1000 OF
   (SELECT * FROM mydata WHERE <some condition>)

should return 1000 random rows from the select statement so that two consecutive evaluations of the query would only with very little probability return the same 1000 rows.
(Yes, I know that "SAMPLE 1000 OF" is not valid SQL)

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux