Re: Planner chooses slow index heap scan despite accurate row estimates - Mailing list pgsql-performance

From Jake Magner
Subject Re: Planner chooses slow index heap scan despite accurate row estimates
Date
Msg-id 1464482313581-5905453.post@n5.nabble.com
Whole thread Raw
In response to Re: Re: Planner chooses slow index heap scan despite accurate row estimates  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: Planner chooses slow index heap scan despite accurate row estimates  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-performance
Tom Lane-2 wrote
> Jake Magner <

> jakemagner90@

> > writes:
>> I tried without doing an INSERT at all, just running the SELECT queries
>> and
>> the result is the same. Nested loop is chosen but is much slower.
>
> FWIW, I just noticed that the comparisons you're using are plain equality
> of the arrays.  While a GIN array index supports that, it's not exactly
> its strong suit: the sort of questions that index type supports well are
> more like "which arrays contain value X?".  I wonder if it'd be worth
> creating btree indexes on the array column.

I added btree indexes and now the nested loop uses those and is a bit faster
than the hash join. So the planner just misestimates the cost of doing the
equality comparisons? I'd prefer not to add more indexes, the hash join
performance is fast enough if it would just choose that but I'm reluctant to
turn off nested loops in case the table gets a lot bigger.



--
View this message in context:
http://postgresql.nabble.com/Planner-chooses-slow-index-heap-scan-despite-accurate-row-estimates-tp5905357p5905453.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: Planner chooses slow index heap scan despite accurate row estimates
Next
From: Johan Fredriksson
Date:
Subject: Re: Performance problems with 9.2.15