Alban Hertroys <alban@xxxxxxxxxxxxxxxxx> writes: > However, mm_product.number always matches either mm_insrel.snumber or > mm_insrel.dnumber (source and destination respectively). The other way > around this isn't the case; then snumber and dnumber match number-fields > in other tables (they always do). Oh, then we are looking at the wrong things: we should be comparing the histograms of the fields that are being used as the join keys in this query. I had thought they were both "number", but I must be confused. regards, tom lane