在Oracle SQL中,我可以查询表的分区而不是整个表来使其运行得更
发布时间:2020-12-12 15:11:35 所属栏目:百科 来源:网络整理
导读:我想查询一张名为’FooBar’的客户有一百万条记录的表,其记录日期为2016年12月7日.该表中有10天的数据. select * from tablewhere customer = 'FooBar'and insert_date between to_date('2016-07-24 00:00:00','YYYY-MM-DD HH24:MI:SS') and to_date('2016-0
我想查询一张名为’FooBar’的客户有一百万条记录的表,其记录日期为2016年12月7日.该表中有10天的数据.
select * from table where customer = 'FooBar' and insert_date between to_date('2016-07-24 00:00:00','YYYY-MM-DD HH24:MI:SS') and to_date('2016-07-24 23:59:59','YYYY-MM-DD HH24:MI:SS'); 上面的查询的问题是它需要一段时间才能运行.我希望它运行得更快. 该表分为24小时.我可以将查询集中在表分区上吗?这会使查询运行得更快吗? select * from partition-7-24-2016 where customer = 'FooBar';正确的语法是从[table] partition([partition])中选择[columns].所以,在这个用例中,你会有这样的东西: SELECT * FROM mytable PARTITION (partition_7_24_2016) WHERE customer = 'FooBar'; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |