Re: aggregate on zero rows slow?
От | Shaun Thomas |
---|---|
Тема | Re: aggregate on zero rows slow? |
Дата | |
Msg-id | Pine.LNX.4.44.0205021007510.16874-100000@hamster.lee.net обсуждение исходный текст |
Ответ на | Re: aggregate on zero rows slow? (Patrick Welche <prlw1@newn.cam.ac.uk>) |
Список | pgsql-general |
On Thu, 2 May 2002, Patrick Welche wrote: > On Wed, May 01, 2002 at 10:21:48PM -0400, Tom Lane wrote: > > Patrick Welche <prlw1@newn.cam.ac.uk> writes: > > > ... the select appears to take much longer to complete if the WHERE clause > > > matches zero rows, than if it matches some rows. > > > > Doesn't make any sense to me. Are you sure the same plan is being > > chosen in both cases? If so, could you post a complete example? > > Yes, same plan both cases. Thanks for the answer: as it doesn't make any > sense to anyone, it must mean there is some corruption somewhere as a result > of Monday morning's powercut => I'll look elsewhere. Could it possibly be that, since it can't find any rows, it's fully exhausting the indexes looking for the values it wants? I mean, a match would presumably be found in the indexes before hitting the end, but a non-match wouldn't. If the index is big enough, I could see a query that returned no results taking longer than one which does. -- +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ | Shaun M. Thomas INN Database Administrator | | Phone: (309) 743-0812 Fax : (309) 743-0830 | | Email: sthomas@townnews.com AIM : trifthen | | Web : www.townnews.com | | | | "Most of our lives are about proving something, either to | | ourselves or to someone else." | | -- Anonymous | +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
В списке pgsql-general по дате отправления: