Re: Gsoc2012 Idea --- Social Network database schema - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Gsoc2012 Idea --- Social Network database schema
Date
Msg-id 1481.1332344098@sss.pgh.pa.us
Whole thread Raw
In response to Re: Gsoc2012 Idea --- Social Network database schema  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Gsoc2012 Idea --- Social Network database schema
Re: Gsoc2012 Idea --- Social Network database schema
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Well, the standard syntax apparently aims to reduce the number of
> returned rows, which ORDER BY does not.  Maybe you could do it with
> ORDER BY .. LIMIT, but the idea here I think is that we'd like to
> sample the table without reading all of it first, so that seems to
> miss the point.

I think actually the traditional locution is more likeWHERE random() < constant
where the constant is the fraction of the table you want.  And yeah,
the presumption is that you'd like it to not actually read every row.
(Though unless the sampling density is quite a bit less than 1 row
per page, it's not clear how much you're really going to win.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Proposal: PL/pgPSM for 9.3
Next
From: Qi Huang
Date:
Subject: Re: Gsoc2012 Idea --- Social Network database schema