I have a classic skew problem impacting performance of a left outer join (left table is "big", right table is "small"). The skewed keys are primarily NULL (by a long way) and secondarily "keyX".
I've tried a few different things:
- adding a join predicate "IS NOT NULL" on the skewed key doesn't seem to have any noticeable impact. and besides i have "keyX" to deal with
- i've had mixed results using hive.optimize.skewjoin
- the "key salting" technique referenced in a few articles i found works great (3x - 4x faster)! but i'm mindful of adding complexity to the query and it does require modifying each problem query, educating various other engineers etc
- i just noticed a very promising feature where you can specify skew in the metastore and have hive use that to generate a skew optimized execution plan. I'd love to test this before i fall back on option 3, but i can't seem to get NULL into the list of Skewed Values. It will accept this:
alter table T skewed by (skewed_key) on ('keyX');
but not this:
alter table T skewed by (skewed_key) on ('keyX',NULL);
Any ideas what's wrong with this syntax? Or does this feature not accept NULL Skew Values?
I'm open to other solutions to the skew problem in general also :)