Re: OFFSET and LIMIT - performance
От
Simon Riggs
Тема
Re: OFFSET and LIMIT - performance
Дата
Msg-id
1183104637.3589.70.camel@silverbirch.site
Ответ на
Re: OFFSET and LIMIT - performance (David Wall)
Список
Дерево обсуждения
OFFSET and LIMIT - performance "Jan Bilek" <bilekj@gmail.com>
Re: OFFSET and LIMIT - performance Tom Lane <tgl@sss.pgh.pa.us>
Re: OFFSET and LIMIT - performance David Wall <d.wall@computer.org>
Re: OFFSET and LIMIT - performance "Simon Riggs" <simon@2ndquadrant.com>
Re: OFFSET and LIMIT - performance Kaloyan Iliev <kaloyan@digsys.bg>
On Thu, 2007-06-28 at 11:36 -0700, David Wall wrote: > > Network transmission costs alone would make the second way a loser. > > > > Large OFFSETs are pretty inefficient because the backend generates and > > discards the rows internally ... but at least it never converts them to > > external form or ships them to the client. Rows beyond the LIMIT are > > not generated at all. > > > Some of this would depend on the query, too, I suspect, since an ORDER > BY would require the entire result set to be determined, sorted and then > the limit/offset could take place. In 8.3 a LIMIT clause will be evaluated at the same time as ORDER BY, so that the full sort cost is avoided. This means that queries with LIMIT are more likely to return in constant time, whether you have no ORDER BY, an ORDER BY on an index, or an ORDER BY with no index. So indexes specifically to provide a fast ORDER BY/LIMIT are no longer required. Courtesy of Greg Stark. -- Simon Riggs EnterpriseDB http://www.enterprisedb.com
В списке pgsql-general по дате отправления