Re: Optimizing DISTINCT with LIMIT - Mailing list pgsql-hackers

From Grzegorz Jaskiewicz
Subject Re: Optimizing DISTINCT with LIMIT
Date
Msg-id 1E3782D0-1A9D-4C28-A307-F06E767312AA@pointblue.com.pl
Whole thread Raw
In response to Re: Optimizing DISTINCT with LIMIT  (David Lee Lambert <davidl@lmert.com>)
Responses Re: Optimizing DISTINCT with LIMIT
List pgsql-hackers
On 2008-12-06, at 11:29, David Lee Lambert wrote:
>>
>
> I use "ORDER BY random() LIMIT :some_small_number" frequently to get  
> a "feel"
> for data.  That always builds the unrandomized relation and then  
> sorts it.  I
> guess an alternate path for single-table queries would be to  
> randomly choose
> a block number and then a tuple number;  but that would be biased  
> toward long
> rows (of which fewer can appear in a block).

but that's going to be extremely slow, due to speed of random()  
function.



pgsql-hackers by date:

Previous
From: Martin Pihlak
Date:
Subject: Re: SQL/MED compatible connection manager
Next
From: "Robert Haas"
Date:
Subject: benchmarking the query planner (was Re: Simple postgresql.conf wizard)