Re: Random Sample - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Random Sample
Date
Msg-id AFCCBB403D7E7A4581E48F20AF3E5DB202C5B1AA@EXADV1.host.magwien.gv.at
Whole thread Raw
In response to Random Sample  (<tom@tacocat.net>)
List pgsql-general
> How do I pull a random sample of either 100 records or 5% of the
> population of a table?

SELECT table.* FROM table
ORDER BY random()
LIMIT n;

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: novnov
Date:
Subject: Re: Trigger function which inserts into table; values from lookup
Next
From: Rodrigo De León
Date:
Subject: Re: doverlaps() returns null