Re: Optimizing DISTINCT with LIMIT
От | David Lee Lambert |
---|---|
Тема | Re: Optimizing DISTINCT with LIMIT |
Дата | |
Msg-id | 200812060629.08223.davidl@lmert.com обсуждение исходный текст |
Ответ на | Re: Optimizing DISTINCT with LIMIT (Gregory Stark <stark@enterprisedb.com>) |
Ответы |
Re: Optimizing DISTINCT with LIMIT
|
Список | pgsql-hackers |
On Thursday 04 December 2008 15:09, Gregory Stark wrote: > tmp <skrald@amossen.dk> writes: > > Also, it is my impression that many people use LIMIT to minimize the > > evaluation time of sub queries from which the outer query only needs a > > small subset of the sub query output. > > I've seen lots of queries which only pull a subset of the results too -- > but it's always a specific subset. So that means using ORDER BY or a WHERE > clause to control it. 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). -- David Lee Lambert ... Software Developer Cell phone: +1 586-873-8813 ; alt. email <as4109@wayne.edu> or <lamber45@msu.edu> GPG key at http://www.lmert.com/keyring.txt
В списке pgsql-hackers по дате отправления: