Added new internal (for now) function compare_schema and use it in merge to optimize out redimensions