Re: using CURSOR with PHP

Поиск
Список
Период
Сортировка
От Andrew McMillan
Тема Re: using CURSOR with PHP
Дата
Msg-id 1021766374.30043.406.camel@kant.mcmillan.net.nz
обсуждение исходный текст
Ответ на Re: using CURSOR with PHP  ("mike" <mike@partner2partner.com>)
Ответы Re: using CURSOR with PHP
Список pgsql-php
On Sun, 2002-05-19 at 11:18, mike wrote:
> Andrew McMillan writes:
> > PostgreSQL will certainly take LIMIT into account when planning queries.
>
> I would think most queries using LIMIT would also include an ORDER BY clause
> which would require PostgreSQL to sort all the results before applying the
> LIMIT.

Then you would be wrong.  ORDER BY can also be handled by an index, if
there is an appropriate one, and this is where PostgreSQL will switch
query plans because traversing an index to grab a few hundred records is
much faster than a sequential scan and sort of many thousands.

With 7.2 PostgreSQL is getting pretty smart with its query planning, but
recognising limits and doing index scans is something that has been
around since at least 7.0, possibly earlier.


> > OTOH PostgreSQL does _not_ do result caching, unless you have applied
> > some patches that were floating around last year some time.
>
> PostgreSQL might not do 'result caching' but if you have an adequate number
> of buffers configured would it not be likely that the results from the last
> query are still in memory?

Yep.  Or the tables could be in Linux' file cache too, but neither of
those provides the same huge performance boost that result caching will
in those few narrow situations in which it applies.

I'd really like to see result caching incorporated into PostgreSQL at
some point but there are many features like that.  Being able to
natively create full-text indexes remains my most wished-for feature.

Cheers,
                    Andrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/        PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201    MOB: +64(21)635-694    OFFICE: +64(4)499-2267
       Are you enrolled at http://schoolreunions.co.nz/ yet?


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

Предыдущее
От: "mike"
Дата:
Сообщение: Re: using CURSOR with PHP
Следующее
От: Keary Suska
Дата:
Сообщение: Re: using CURSOR with PHP