Dmitri Koulikov <koulikoff@gmail.com> writes:
> Hello. I've prepared a sample. It turned out that the problem lies in other
> place.
> In the attachment there is output from explain and a sample
This isn't a self-contained test case :-(. I guessed at some index
definitions but couldn't reproduce the plan exactly, and in any case
it's clear from your EXPLAIN output there are more than just these
three rows in your tables.
regards, tom lane