下面的查询扫描100 mb的数据。
select * from table where column1 = 'val' and partition_id = '20190309';
Run Code Online (Sandbox Code Playgroud)
但是,以下查询将扫描15 GB的数据(分区超过90个)
select * from table where column1 = 'val' and partition_id in (select max(partition_id) from table);
Run Code Online (Sandbox Code Playgroud)
如何优化第二个查询以扫描与第一个查询相同的数据量?