The Hermit Hacker <scrappy@hub.org> writes:
>> So that inflates the number of rows coming out of the join by 5.
> Okay, then I'm lost ... why wouldn't that show up without the COUNT()? I
> doubt doubt your analysis, I just want to understand why ...
You had DISTINCT on your query, which hid the duplicated rows from you.
But that happens *after* aggregate processing, so it doesn't hide the
dups from COUNT().
regards, tom lane