On 2 June 2017 at 03:46, Teodor Sigaev <teodor@sigaev.ru> wrote:
> I miss here why could the presence of index influence on that? removing
> index causes a good plan although it isn't used in both plans .
Unique indexes are used as proofs when deciding if a join to the
relation is "inner_unique". A nested loop unique join is costed more
cheaply than a non-unique one since we can skip to the next outer
tuple once we've matched the current outer tuple to an inner tuple. In
theory that's half as many comparisons for a non-parameterised nested
loop.
-- David Rowley http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services