SQL 如何在多个分区上进行选择?
有没有比以下更有效的方法:
select * from transactions partition( partition1 )
union all
select * from transactions partition( partition2 )
union all
select * from transactions partition( partition3 );
Is there a more efficient way than:
select * from transactions partition( partition1 )
union all
select * from transactions partition( partition2 )
union all
select * from transactions partition( partition3 );
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在查询中使用 PARTITION(partitionN) 语法的情况应该非常罕见。
您通常只想指定分区键的值并允许 Oracle 执行分区消除。例如,如果您的表根据 TRANSACTION_DATE 每天进行分区,
则将从今天的分区、昨天的分区和前天的分区中选择所有数据。
It should be exceptionally rare that you use the PARTITION( partitionN ) syntax in a query.
You would normally just want to specify values for the partition key and allow Oracle to perform partition elimination. If your table is partitioned daily based on TRANSACTION_DATE, for example
would select all the data from today's partition, yesterday's partition, and the day before's partition.
您能提供更多背景信息吗?你的谓词是什么?是什么让您认为您需要明确告诉优化器针对多个分区。例如,您可能使用了错误的分区键。
Can you provide additional context? What are your predicates? What makes you think that you need to explicitly tell the optimizer to go against multiple partitions. You may have the wrong partition key in use, for example.