CREATE TABLE test_multiif_t(d Nullable(Int64)) ENGINE Memory INSERT INTO test_multiif_t SELECT * from numbers(300000000) select count(1) from test_multiif_t where multiIf(d > 2, d-2, d > 1, d-1, d >0, d, 0) > 1 SETTINGS max_threads=1 DROP TABLE IF EXISTS test_multiif_t