Hi I am having a pretty basic problem. I have an orders table which I am joining with some other table.
I am filtering the orders table to get back the orders of just the last 30 days and also the related rows from the other table. On the orders table the query optimizer correctly gets the proper estimation of rows to be returned, in my case, 39,000 rows. But when it comes to the joined table the estimates are at almost a half million records, the whole size of the other table. It seems that the optimizer doesn’t know how to guess how much rows I will have to return from the other table. Can’t understand why. What am I missing, I am joining the tables using the PK from the orders table and a FK in the foreign table, All fully indexed. Can anyone help me. Big thanks