Fix a sales total that comes out four times too big, by counting rows
Join the order items and payments, add it up, and sales go from 9,200 yen to 37,200. You count the rows after the join to find where they multiplied, then rewrite it to aggregate first and join after. Finally you read the query plan to see whether the index is used.