```sql

drop table if exists t ;
drop table if exists temp ;

CREATE TABLE t
(
    game String,
    round String,
    casino Int32)
ENGINE = MergeTree() ORDER BY (casino, game, round);

CREATE TABLE temp
(
    game String,
    round String,
    casino Int32)
ENGINE = MergeTree() ORDER BY (casino, game, round);

insert into t(casino, game, round)
select number%103, toString(cityHash64(number%999)), toString(number) from numbers(3, 50000000);

insert into temp(casino, game, round)
select number%103, toString(cityHash64(number%999)), toString(number) from numbers(5000);

Q1: SELECT count(*)
FROM temp WHERE (casino, game, round) NOT IN
(     SELECT  casino, game, round
    FROM t
    WHERE (casino, game, round) IN
    (
        SELECT casino, game, round
        FROM temp
    )
)

21.3.1.5944  Elapsed: 4.464 sec. Processed 5.00 thousand rows, 225.89 KB (1.12 thousand rows/s., 50.60 KB/s.)

20.8.11.17    Elapsed: 0.611 sec. Processed 5.00 thousand rows, 225.89 KB (8.18 thousand rows/s., 369.73 KB/s.)

18.14.19.    Elapsed: 0.341 sec. Processed 5.00 thousand rows, 225.89 KB (14.66 thousand rows/s., 662.46 KB/s.)

```
*  throw out unnecessary columns based on the entire query. In unnecessary parts of the query, we will not execute subqueries.
        */
    const ASTSelectQuery & query = *query_analyzer.getSelectQuery();
    const Context & context = query_analyzer.context;
    const Settings & settings = context.getSettingsRef();
    const ConstStoragePtr & storage = query_analyzer.storage();
    bool finalized = false;
    size_t where_step_num = 0;
    auto finalize_chain = [&](ExpressionActionsChain & chain)
    {
        chain.finalize();
        if (!finalized)
        {
            finalize(chain, where_step_num);
            finalized = true;
        }
        chain.clear();
    };
    if (storage)
    {
        query_analyzer.makeSetsForIndex(query.where());
        query_analyzer.makeSetsForIndex(query.prewhere());
    }
    {
        ExpressionActionsChain chain(context);
        Names additional_required_columns_after_prewhere;
        if (storage && (query.sampleSize() || settings.parallel_replicas_count > 1))
        {
            Names columns_for_sampling = metadata_snapshot->getColumnsRequiredForSampling();
            additional_required_columns_after_prewhere.insert(additional_required_columns_after_prewhere.end(),