Re: Limit Heap Fetches / Rows Removed by Filter in Index Scans

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: Limit Heap Fetches / Rows Removed by Filter in Index Scans
Дата
Msg-id CA+bJJbzUsuc38Gn4=b-t+euWbKZ+ZQMvOm-QVmn_rrrN-0bHyQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Limit Heap Fetches / Rows Removed by Filter in Index Scans  (Victor Blomqvist <vb@viblo.se>)
Список pgsql-general
Victor:

On Fri, Aug 19, 2016 at 8:01 PM, Victor Blomqvist <vb@viblo.se> wrote:

> Thanks! A sub select seems to do it.

I suspected it would be needed, that's why I sugested it.

I prefer to write the queries as CTEs because they are much easier to
read, but IIRC they are some kind of 'optimization fences'. Some times
I end up using psql macros to write queries in CTE-like order in my
scripts and compose them into sub selects when I have this problems.

> Checking these two queries I can see that the first one visits the
> max 50 rows its allowed to and returns 5 rows, while the second one
> finish off after 13 rows fetched and returns the full 10 rows.

Good. The only problem is you are not guaranteed a result, like in the
contrived example I gave, but if it is what you want this is a way to
go.

Francisco Olarte.


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

Предыдущее
От: Sameer Kumar
Дата:
Сообщение: Re: PG vs ElasticSearch for Logs
Следующее
От: Bruno Wolff III
Дата:
Сообщение: endash not a graphic character?