Re: Selecting K random rows - efficiently! - Mailing list pgsql-general

From cluster
Subject Re: Selecting K random rows - efficiently!
Date
Msg-id ffn1i3$2f16$1@news.hub.org
Whole thread Raw
In response to Selecting K random rows - efficiently!  (cluster <skrald@amossen.dk>)
Responses Re: Selecting K random rows - efficiently!  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
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)

pgsql-general by date:

Previous
From: Laurent ROCHE
Date:
Subject: Re : pg_dump auto login
Next
From: Gregory Stark
Date:
Subject: Re: deadlock detected, only selects (not select-for-update)