**How to reproduce**
```
CREATE TABLE test_order_by (timestamp DateTime, key UInt32) ENGINE=MergeTree() PARTITION BY toYYYYMM(timestamp) ORDER BY (toDate(timestamp), key);
INSERT INTO test_order_by SELECT now() + toIntervalSecond(number), number % 4 FROM numbers(10000000);
OPTIMIZE TABLE test_order_by FINAL;
Q1: SELECT * FROM test_order_by ORDER BY timestamp LIMIT 10;
Q2: SELECT * FROM test_order_by ORDER BY toDate(timestamp) LIMIT 10;
Q3: SELECT * FROM test_order_by ORDER BY toDate(timestamp), timestamp LIMIT 10;

Q1 works the same on all versions of clickhouse.
Q1: 10 rows in set. Elapsed: 0.060 sec. Processed 10.00 million rows, 80.00 MB (166.87 million rows/s., 1.33 GB/s.)

Clickhouse 20.3.19
Q2: 10 rows in set. Elapsed: 0.013 sec. Processed 655.36 thousand rows, 5.24 MB (50.57 million rows/s., 404.54 MB/s.)
Q3: 10 rows in set. Elapsed: 0.034 sec. Processed 720.90 thousand rows, 5.77 MB (21.15 million rows/s., 169.23 MB/s.)
Clickhouse 20.4.2.9
Q2: Code: 15. DB::Exception: Received from localhost:9000. DB::Exception: Column 'toDate(timestamp)' already exists.
Q3: Code: 15. DB::Exception: Received from localhost:9000. DB::Exception: Column 'toDate(timestamp)' already exists.
Clickhouse 20.5.5.74
Q2: 10 rows in set. Elapsed: 0.020 sec. Processed 1.44 million rows, 11.53 MB (72.88 million rows/s., 583.04 MB/s.)
Q3: 10 rows in set. Elapsed: 0.013 sec. Processed 1.57 million rows, 12.58 MB (121.66 million rows/s., 973.31 MB/s.)
Clickhouse 20.6.8.5
Q2: 10 rows in set. Elapsed: 0.008 sec. Processed 1.05 million rows, 8.39 MB (131.13 million rows/s., 1.05 GB/s.)
Q3: 10 rows in set. Elapsed: 0.011 sec. Processed 1.11 million rows, 8.91 MB (105.19 million rows/s., 841.48 MB/s.)
Clickhouse 20.7.4.11
Q2: 10 rows in set. Elapsed: 0.008 sec. Processed 1.05 million rows, 8.38 MB (130.08 million rows/s., 1.04 GB/s.)
Q3: 10 rows in set. Elapsed: 0.012 sec. Processed 1.11 million rows, 8.91 MB (90.35 million rows/s., 722.80 MB/s.)
Clickhouse 20.8.4.11
Q2: 10 rows in set. Elapsed: 0.046 sec. Processed 10.00 million rows, 80.00 MB (215.31 million rows/s., 1.72 GB/s.)
Q3: 10 rows in set. Elapsed: 0.054 sec. Processed 10.00 million rows, 80.00 MB (185.84 million rows/s., 1.49 GB/s.)
Clickhouse 20.9.3
Q2: 10 rows in set. Elapsed: 0.055 sec. Processed 10.00 million rows, 80.00 MB (181.47 million rows/s., 1.45 GB/s.)
Q3: 10 rows in set. Elapsed: 0.040 sec. Processed 10.00 million rows, 80.00 MB (250.70 million rows/s., 2.01 GB/s.)


```
**Additional context**
It would be a good feature, of clickhouse will use optimize in order with monotonic functions without ORDER BY rewriting.
` SET optimize_monotonous_functions_in_order_by = 1` has no affect on that kind of queries.

if (!expr->as<ASTIdentifier>() || source_columns_set.count(source_name))
            {
                result.array_join_result_to_source[result_name] = source_name;
            }
            else 
            {
                bool found = false;
                for (const auto & column : source_columns)
                {
                    auto split = Nested::splitName(column.name);
                    if (split.first == source_name && !split.second.empty())
                    {
                        result.array_join_result_to_source[Nested::concatenateName(result_name, split.second)] = column.name;
                        found = true;
                        break;
                    }
                }
                if (!found)
                    throw Exception("No columns in nested table " + source_name, ErrorCodes::EMPTY_NESTED_TABLE);
            }
        }
    }
}
void setJoinStrictness(ASTSelectQuery & select_query, JoinStrictness join_default_strictness, bool old_any, ASTTableJoin & out_table_join)
{
    const ASTTablesInSelectQueryElement * node = select_query.join();
    if (!node)
        return;
    auto & table_join = const_cast<ASTTablesInSelectQueryElement *>(node)->table_join->as<ASTTableJoin &>();
    if (table_join.strictness == ASTTableJoin::Strictness::Unspecified &&