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

2016-10-14 Thread Tom Lane
Kyle Moser 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

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

2016-10-14 Thread Kyle Moser
Tom, 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

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

2016-10-14 Thread Tom Lane
Kyle Moser writes: > The depesz link for explain (analyze, buffers) is shown below for 3 > different queries. The first two queries show a log dump of the postgres > log, showing a query that was generated by Java Hibernate. The third query > was one I wrote and ran in