Re: LIMIT Question

Поиск
Список
Период
Сортировка
От Gurjeet Singh
Тема Re: LIMIT Question
Дата
Msg-id 65937bea0802290358m64976999m2d0c7c428eeadbea@mail.gmail.com
обсуждение исходный текст
Ответ на Re: LIMIT Question  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: LIMIT Question
Список pgsql-general

On Fri, Feb 29, 2008 at 3:55 PM, Martijn van Oosterhout <kleptog@svana.org> wrote:
On Fri, Feb 29, 2008 at 02:53:05PM +0530, Gurjeet Singh wrote:
> In my opinion (without looking at the code), if you have a grouping-function
> or ORDER BY or GROUP BY clause, then yes, the whole query has to be executed
> to show the first row of the result-set. But if the query doesn't have any
> of these clauses, then the DB has the ability to send back the first row
> from the result as soon as it processes it (i.e after WHERE clause
> processing), and stop the query execution there.

Except if you have an index on the column you're ordering by. Then the
server can really return the first row quickly.

Quickly for sure... but I don't think 'without processing all the rows that qualify'. I think it will still process all the rows and return just one.

Best regards,
--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB      http://www.enterprisedb.com

17° 29' 34.37"N,  78° 30' 59.76"E - Hyderabad
18° 32' 57.25"N,  73° 56' 25.42"E - Pune *
37° 47' 19.72"N, 122° 24' 1.69" W - San Francisco

http://gurjeet.frihost.net

Mail sent from my BlackLaptop device

В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: LIMIT Question
Следующее
От: Sam Mason
Дата:
Сообщение: Re: LIMIT Question