SQL query plan overestimation
Thanks in advance.
In that example, inputs of 31,672 and 20,569 rows are estimated to produce 12,666,400 rows when joined. You should check your join conditions carefully, and also the database design to ensure you have uniqueness enforced where it should be. It's hard to be specific based on an anonymized plan, but those are the usual causes.