关于teradata中分区主索引的问题

关于teradata中分区主索引的问题,teradata,partition,Teradata,Partition,我在表中创建一个分区主索引 create TABLE customerservice.ordertbl_new ( ORDER_ID integer NOT NULL, CUST_ID integer NOT NULL, ORDER_DATE date , ORDER_AMOUNT integer ) PRIMARY INDEX (CUST_ID) PARTITION BY case_n( ORDER_AMOUNT < 10000 , ORDER_AMOUNT < 20000

我在表中创建一个分区主索引

create TABLE customerservice.ordertbl_new
(
ORDER_ID  integer NOT NULL,
CUST_ID integer NOT NULL,
ORDER_DATE  date ,
ORDER_AMOUNT integer
)
PRIMARY INDEX (CUST_ID)
PARTITION BY case_n(
ORDER_AMOUNT  < 10000 ,
ORDER_AMOUNT  < 20000 ,
ORDER_AMOUNT  < 30000,
NO case OR UNKNOWN);
现在我试着像这样查询这个表

explain sel * from customerservice.ordertbl_new where order_amount < 10000;
解释customerservice.ordertbl\u new中的sel*,其中订单金额<10000;
结果如下:

Explanation
---------------------------------------------------------------------------
1) First, we lock a distinct customerservice."pseudo table" for read
 on a RowHash to prevent global deadlock for
 customerservice.ordertbl_new.
2) Next, we lock customerservice.ordertbl_new for read.
3) We do an all-AMPs RETRIEVE step from 2 partitions of
 customerservice.ordertbl_new with a condition of (
 "customerservice.ordertbl_new.ORDER_AMOUNT < 10000") into Spool 1
 (group_amps), which is built locally on the AMPs.  The size of
 Spool 1 is estimated with no confidence to be 2 rows (124 bytes).
 The estimated time for this step is 0.06 seconds.
4) Finally, we send out an END TRANSACTION step to all AMPs involved
 in processing the request.
-> The contents of Spool 1 are sent back to the user as the result of
 statement 1.  The total estimated time is 0.06 seconds.
解释
---------------------------------------------------------------------------
1) 首先,我们锁定一个独特的customerservice。“伪表”用于读取
在RowHash上防止的全局死锁
customerservice.ordertbl\u新建。
2) 接下来,我们锁定customerservice.ordertbl_new以供读取。
3) 我们从2个分区执行一个all AMPs检索步骤
customerservice.ordertbl_新建,条件为(
“customerservice.ordertbl_new.ORDER_AMOUNT<10000”)输入滑阀1
(组_安培),该组在安培上本地构建。大小
Spool 1估计为2行(124字节),没有任何可信度。
此步骤的估计时间为0.06秒。
4) 最后,我们向所有涉及的AMP发送结束事务步骤
在处理请求时。
->滑阀1的内容将作为操作的结果发送回用户
报表1。总估计时间为0.06秒。

我的问题是:为什么要从2个分区执行all AMPs检索步骤?订单金额小于10000的所有记录都应该安排在一个分区中,为什么这里有两个分区

分区位于每个放大器上。数据通过cust_id分布在AMP上。扫描的是
未知的
分区,只是不要问为什么:-)好的,我知道扫描的是未知的,谢谢
Explanation
---------------------------------------------------------------------------
1) First, we lock a distinct customerservice."pseudo table" for read
 on a RowHash to prevent global deadlock for
 customerservice.ordertbl_new.
2) Next, we lock customerservice.ordertbl_new for read.
3) We do an all-AMPs RETRIEVE step from 2 partitions of
 customerservice.ordertbl_new with a condition of (
 "customerservice.ordertbl_new.ORDER_AMOUNT < 10000") into Spool 1
 (group_amps), which is built locally on the AMPs.  The size of
 Spool 1 is estimated with no confidence to be 2 rows (124 bytes).
 The estimated time for this step is 0.06 seconds.
4) Finally, we send out an END TRANSACTION step to all AMPs involved
 in processing the request.
-> The contents of Spool 1 are sent back to the user as the result of
 statement 1.  The total estimated time is 0.06 seconds.