zoukankan      html  css  js  c++  java
  • teradata中EXPLAIN执行计划总结

    对于teradata SQL级别的优化,使用EXPLAIN查看执行计划基本上是最直接也最好用的。
    EXPLAIN 展示出来的内容重要但同时也很多,我们只需要提取其中的关键字便可大致描述出来我么SQL的执行过程。

    数据检索涉及到AMPs: All-AMPs retrieve step, Single-AMP retrieve step等这些内容表明了我们的SQL检索数据用到了那些AMP来协同工作。

    数据检索的策略:我们经常可以看到诸如下面的内容:by way of all-row scan(相当了全表扫描), by way of the primary index, by the way of hash value(通常发生于JOIN的时候)。这些表明了AMP检索数据的方式

    Join 前的处理:由于teradata要求JOIN的数据在同一个AMP上,因此Join 前必然会交换数据,不论是数据的重分布(redistribution )还是复制表(duplicated )。我们经常可以看到这些内容duplicated on all AMPs, redistributed by the hash code of (new hash column(s))。这些表明了数据交换的方式。

    Join的类型:数据被放置于同一个AMP后Join才会产生,teradata会选择Join的类型。using a product join, using a single partition hash join, using a merge join这些表明了Join的类型

    Confidence Level(不知怎么用中文描述):是影响teradata优化器的一个重要因子,分为四个级别
    • No confidence
    • Low confidence
    • High confidence
    • Index Join confidence(仅对于表之间的Join)
    我们经常可以看到这样的内容 The size of Spool 1 is estimated with no confidence to be 428 rows
    基本上我们可以认为越低级别的Confidence,可信度越不高。Confidence受统计信息的影响,因此当我们Confidence过低时应该考虑下是否收集下统计信息。(统计信息并不是影响Confidence的唯一因素 )

    在工作中就遇到这样的坑:两表关联。一张表的数据分布到140多个AMP上,大概每个AMP上100多W,维表DISTINCT以后大概4到5W的样子。但是由于维表统计信息是在最初收集的,就看到了上面那样的情况,teradata估算维表也就几百条样子,最后产生了product join。根据product join原理,每个AMP产生的比较次数为100*40000 万次。最后收集统计信息Join的策略变为了hash join
    ————————————————
    版权声明:本文为CSDN博主「_假象」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/wali_wang/article/details/50494539

  • 相关阅读:
    形象理解ERP(转)
    禁用windows server 2008 域密码复杂性要求策略
    How to adding find,filter,remove filter on display method Form
    Windows Server 2008 R2激活工具
    How to using bat command running VS development SSRS report
    Creating Your First Mac AppGetting Started
    Creating Your First Mac AppAdding a Track Object 添加一个 Track 对象
    Creating Your First Mac AppImplementing Action Methods 实现动作方法
    Creating Your First Mac AppReviewing the Code 审查代码
    Creating Your First Mac AppConfiguring the window 设置窗口
  • 原文地址:https://www.cnblogs.com/cmbk/p/12073686.html
Copyright © 2011-2022 走看看