It would be great if `optimize_on_insert` was smart enough to discard empty blocks
```
create table empty (num Int8) engine=Memory;
CREATE MATERIALIZED VIEW empty_mv
(
    `num` Int8
)
ENGINE = SummingMergeTree
ORDER BY tuple() AS
SELECT num
FROM empty;

-- First insert

set optimize_on_insert=1;
insert into empty values (0);

-- 20 minutes break

set optimize_on_insert=0;
insert into empty values (0);

-- Created parts

SELECT
    event_type,
    event_time,
    table,
    part_name,
    rows
FROM system.part_log
PREWHERE (event_date = today()) AND (table LIKE '%empty%')
ORDER BY event_time ASC
FORMAT PrettyCompactMonoBlock

┌─event_type─┬──────────event_time─┬─table───────────┬─part_name─┬─rows─┐
│ NewPart    │ 2021-02-10 21:27:40 │ .inner.empty_mv │ all_1_1_0 │    0 │
│ RemovePart │ 2021-02-10 21:27:42 │ .inner.empty_mv │ all_1_1_0 │    0 │
│ NewPart    │ 2021-02-10 21:46:42 │ .inner.empty_mv │ all_2_2_0 │    1 │
└────────────┴─────────────────────┴─────────────────┴───────────┴──────┘
```
transaction.rollbackPartsToTemporaryState();
                part->is_temp = true;
                part->renameTo(temporary_part_relative_path, false);
                
                
                ++loop_counter;
                if (loop_counter == max_iterations)
                {
                    part->is_duplicate = true; 
                    throw Exception("Too many transaction retries - it may indicate an error", ErrorCodes::DUPLICATE_DATA_PART);
                }
                continue;
            }
            else if (multi_code == Coordination::Error::ZNODEEXISTS && failed_op_path == quorum_info.status_path)
            {
                transaction.rollback();
                throw Exception("Another quorum insert has been already started", ErrorCodes::UNSATISFIED_QUORUM_FOR_PREVIOUS_WRITE);
            }
            else
            {
                
                transaction.rollback();
                throw Exception("Unexpected logical error while adding block " + toString(block_number) + " with ID '" + block_id + "': "
                                + Coordination::errorMessage(multi_code) + ", path " + failed_op_path,
                                ErrorCodes::UNEXPECTED_ZOOKEEPER_ERROR);
            }
        }
        else if (Coordination::isHardwareError(multi_code))
        {
            transaction.rollback();