SAP ASE 数据库中的分区 pruning/elimination
Partition pruning/elimination in SAP ASE database
我想为 SAP ASE 数据库实现分区修剪,但分区似乎没有用到。
这是我的问题的一个最小可验证示例:
我创建了一个table:
create table Employee(
empId INT not null,
empName VARCHAR(50) not null,
CONSTRAINT Employee_bk PRIMARY KEY(empId)
)
partition by range (empId)
(
Employee_p1 values <= (5),
Employee_p2 values <= (10),
Employee_p3 values <= (15),
Employee_p4 values <= (20)
)
将以下数据插入table:
empId empName
1 hskf
6 fdgfh
8 kygj
15 zcc
17 xvx
当我从tableselect时,查询returns正确记录:
1>select * from Employee where empId=6
2>go
empId empName
----------- --------------------------------------------------
6 fdgfh
问题是查询计划显示查询正在扫描所有分区而不是排除其他分区扫描:
STEP 1
The type of query is SELECT.
1 operator(s) under root
|ROOT:EMIT Operator (VA = 1)
|
| |SCAN Operator (VA = 0)
| | FROM TABLE
| | Employee
| | [ Partitions Used: 4, Eliminated: 0]
| | [ Eliminated Partition ids : ]
| | [ Used Partition ids : ]
| | [ Using Dynamic Partition Elimination ]
| | Using Clustered Index.
| | Index : Employee_bk
| | Forward Scan.
| | Positioning by key.
| | Keys are:
| | empId ASC
| | Using I/O Size 2 Kbytes for data pages.
| | With LRU Buffer Replacement Strategy for data pages.
根据文档,设置 启用语义分区 设置为 1。
谁能建议如何消除不必要的分区扫描?
可能的解决办法是数据库设置
basic_optimization_partitions
已关闭。检查此设置是否已禁用,以及当此设置打开时分区修剪是否有效。
我想为 SAP ASE 数据库实现分区修剪,但分区似乎没有用到。
这是我的问题的一个最小可验证示例:
我创建了一个table:
create table Employee( empId INT not null, empName VARCHAR(50) not null, CONSTRAINT Employee_bk PRIMARY KEY(empId) ) partition by range (empId) ( Employee_p1 values <= (5), Employee_p2 values <= (10), Employee_p3 values <= (15), Employee_p4 values <= (20) )
将以下数据插入table:
empId empName 1 hskf 6 fdgfh 8 kygj 15 zcc 17 xvx
当我从tableselect时,查询returns正确记录:
1>select * from Employee where empId=6 2>go empId empName ----------- -------------------------------------------------- 6 fdgfh
问题是查询计划显示查询正在扫描所有分区而不是排除其他分区扫描:
STEP 1 The type of query is SELECT. 1 operator(s) under root |ROOT:EMIT Operator (VA = 1) | | |SCAN Operator (VA = 0) | | FROM TABLE | | Employee | | [ Partitions Used: 4, Eliminated: 0] | | [ Eliminated Partition ids : ] | | [ Used Partition ids : ] | | [ Using Dynamic Partition Elimination ] | | Using Clustered Index. | | Index : Employee_bk | | Forward Scan. | | Positioning by key. | | Keys are: | | empId ASC | | Using I/O Size 2 Kbytes for data pages. | | With LRU Buffer Replacement Strategy for data pages.
根据文档,设置 启用语义分区 设置为 1。
谁能建议如何消除不必要的分区扫描?
可能的解决办法是数据库设置
basic_optimization_partitions
已关闭。检查此设置是否已禁用,以及当此设置打开时分区修剪是否有效。