在Teradata中的create table命令中使用AMP

时间:2011-06-06 13:06:15

标签: teradata

我是Teradata的新手。任何人都可以告诉我,在Teradata中创建任何表格时,AMP究竟有多大帮助。 让我们有一个场景。 我有一个带4个AMP的Teradata数据库。我了解到,当我们将数据插入表格时,AMP将非常有用。根据索引,它将在受尊重的AMP的帮助下分发数据。但是在创建表时,命令只需要通过AMP执行。所以我想知道当时会使用哪种AMP?

1 个答案:

答案 0 :(得分:1)

在数据字典中实际创建表是RowHash级操作,涉及单个AMP将记录存储在DBC.TVM中。根据EXPLAIN中列出的其他操作,可能还涉及其他AMP,但没有单一的All-AMP操作。 (这不考虑数据的加载及其在AMP上的分布。)

示例EXPLAIN:

  1) First, we lock FUBAR.ABC for exclusive use. 
  2) Next, we lock a distinct DBC."pseudo table" for write on a RowHash
     for deadlock prevention, we lock a distinct DBC."pseudo table" for
     write on a RowHash for deadlock prevention, we lock a distinct
     DBC."pseudo table" for read on a RowHash for deadlock prevention,
     and we lock a distinct DBC."pseudo table" for write on a RowHash
     for deadlock prevention. 
  3) We lock DBC.DBase for read on a RowHash, we lock DBC.Indexes for
     write on a RowHash, we lock DBC.TVFields for write on a RowHash,
     we lock DBC.TVM for write on a RowHash, and we lock
     DBC.AccessRights for write on a RowHash. 
  4) We execute the following steps in parallel. 
       1) We do a single-AMP ABORT test from DBC.DBase by way of the
          unique primary index. 
       2) We do a single-AMP ABORT test from DBC.TVM by way of the
          unique primary index. 
       3) We do an INSERT into DBC.Indexes (no lock required). 
       4) We do an INSERT into DBC.TVFields (no lock required). 
       5) We do an INSERT into DBC.TVM (no lock required). 
       6) We INSERT default rights to DBC.AccessRights for FUBAR.ABC. 
  5) We create the table header. 
  6) Finally, we send out an END TRANSACTION step to all AMPs involved
     in processing the request.
  -> No rows are returned to the user as the result of statement 1.