Re: Hibernate generated query slow compared to 'equivalent' hand written one

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Hibernate generated query slow compared to 'equivalent' hand written one
Дата
Msg-id 14825.1476470247@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Hibernate generated query slow compared to 'equivalent' hand written one  (Kyle Moser <moser.kyle@gmail.com>)
Список pgsql-performance
Kyle Moser <moser.kyle@gmail.com> writes:
> Thanks so much for the response. They are the same data, that was due to
> deidentification on my part. So even though the second Hibernate query says
> "index only scan" (in addition to the filter, as you said) it is
> inefficient. Why does it say index only scan if it can't use the index due
> to the types being numeric and the index being bigint? (I suppose my
> question here is how to interpret the output properly - so I don't make
> this mistake again).

The key thing to notice about that is that it says "Filter" not
"Index Cond".  That means it's pulling data from the index but
not making use of the index's search ability --- that is, it's
scanning every index entry and applying the "IN" condition to the
value, in much the same way as it'd do with heap entries in a plain
seqscan.  That's a pretty silly plan, which in most cases you would
not get if you hadn't forced it.

            regards, tom lane


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

Предыдущее
От: Kyle Moser
Дата:
Сообщение: Re: Hibernate generated query slow compared to 'equivalent' hand written one
Следующее
От: Bobby Mozumder
Дата:
Сообщение: Should I generate strings in Postgres of Python?