The SQL is much more complex as you code is showing as you seem to access views which contain also some complex logic - are you aware of this?
The high skew is most likely to be related to missing or stale stats.
Check the explain and look for steps where the estimated numbers are not on the same level as you actuals. Check if you can change this discripancy with collecting stats.
The SQL is much more complex as you code is showing as you seem to access views which contain also some complex logic - are you aware of this?
The high skew is most likely to be related to missing or stale stats.
Check the explain and look for steps where the estimated numbers are not on the same level as you actuals. Check if you can change this discripancy with collecting stats.