Re: Hibernate generated query slow compared to 'equivalent' hand written one - Mailing list pgsql-performance

From Tom Lane
Subject Re: Hibernate generated query slow compared to 'equivalent' hand written one
Date
Msg-id 14825.1476470247@sss.pgh.pa.us
Whole thread Raw
In response to Re: Hibernate generated query slow compared to 'equivalent' hand written one  (Kyle Moser <moser.kyle@gmail.com>)
List 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 by date:

Previous
From: Kyle Moser
Date:
Subject: Re: Hibernate generated query slow compared to 'equivalent' hand written one
Next
From: Bobby Mozumder
Date:
Subject: Should I generate strings in Postgres of Python?