Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
oracle在联接和where条件中经常使用的列上进行分区_Oracle_Partitioning_Database Performance - Fatal编程技术网

oracle在联接和where条件中经常使用的列上进行分区

oracle在联接和where条件中经常使用的列上进行分区,oracle,partitioning,database-performance,Oracle,Partitioning,Database Performance,customer表包含950万条记录。customer\u id列是主键。数据库是Oracle 问题: 1) 表应该包含主分区还是子分区?我怎么决定? 此外,由于数据类型的原因,我认为索引columnA或columnB在这里没有帮助 TableA.columnA (varchar) has more than 80% of the records for columnA values 5,6,7. The columnA has values from 1 to 7 only. TableA.c

customer表包含950万条记录。
customer\u id
列是主键。数据库是Oracle

问题:

1) 表应该包含主分区还是子分区?我怎么决定? 此外,由于数据类型的原因,我认为索引columnA或columnB在这里没有帮助

TableA.columnA (varchar) has more than 80% of the records for columnA values 5,6,7. The columnA has values from 1 to 7 only.
TableA.columnB (varchar) has 90% of the records for columnB value = 102. The columnB has values from 1 to 999.
此外,典型的查询是(无特定顺序):

2) 当我们创建子分区时,如果查询只包含子分区列的where子句,会发生什么?查询是直接执行到子分区还是通过主分区执行

3) 联接包含tableA.partitioned\u列=tableB.indexed\u列

(eg. customer_Table.branch_code = branch_table.branch_code)
在连接的情况下分区有帮助吗?它会提高性能吗?

1)很难回答不知道表结构、通常使用的方式等问题。但通常情况下,对于大型表,分区是非常必要的

2) 如果您不指定分区,那么Oracle必须浏览所有分区,以找到子分区所在的位置(速度不是很慢)。然后在子分区上使用分区修剪。如果没有子分区的话,它的速度会更快。但是最好的情况是在
中引用分区和子分区


3) 对于99%,我认为这会有所帮助,因为Oracle可以使用分区修剪从tableA中立即获得所需的行。如果您检查查询计划,您将100%确定。但最好的情况是两列都是分区键。

如果这些列中有80-90%具有相同的值,并且它们是最常被查询的值,那么分区将对某些情况有所帮助。在这些查询过程中,您可能会删减10-20%的数据,但您可能希望找到另一种方法,让Oracle对您的查询所需的数据(可能是日期?)

两列中的值分布也会引出统计信息的要点,并确保正确收集它们(使用直方图来描述这些列中的偏差)

正如@psur所指出的,在不了解系统细节的情况下,很难给出具体的建议

(eg. customer_Table.branch_code = branch_table.branch_code)