Michael Monnerie <michael.monnerie@is.it-management.at> writes:
> Can somebody explain me why on the last line, "dbmail_physmessage",
> there is a seq. scan going on and no index used?
Because it chose to use a hash instead. Given the rowcounts I don't
think that's wrong, but if you want to see the other plan you can try
setting enable_hashjoin = off (and maybe enable mergejoin = off if
it goes to a merge join next).
As for your other question, the reason it likes the dbmail_messages_1
index is probably that it's a lot smaller than dbmail_messages_7.
The only thing I'm seeing that seems curious is that when forced to
use dbmail_messages_7, it isn't using what seems to be an available
index condition.
regards, tom lane