phoenix Explain Plan 翻译

 

Explain Plan
An EXPLAIN plan tells you a lot about how a query will be run:
一个执行计划会告诉你一个执行计划怎么执行
All the HBase range queries that will be executed
所有hbase 范围查询会被执行
An estimate of the number of bytes that will be scanned
评估多少字节会被扫描
An estimate of the number of rows that will be traversed
评估多少行被遍历
Time at which the above estimate information was collected
收集上述评估时间
Which HBase table will be used for each scan
每次扫描那个表会使用
Which operations (sort, merge, scan, limit) are executed on the client versus the server
在客户端和服务端,那个操作 (排序,合并,扫描,限制列数)会被执行
Use an EXPLAIN plan to check how a query will run, and consider rewriting queries to meet the following goals:
用explain plan 执行计划,检测一个查询如何执行,考虑如下目标,来重写查询:
Emphasize operations on the server rather than the client. Server operations are distributed across the cluster and operate in parallel, while client operations execute within the single client JDBC driver.
强调在服务器上执行,而不是在客户端执行。服务器操作是通过分布式集群并发执行,而客户端是通过单一的jdbc驱动执行。
Use RANGE SCAN or SKIP SCAN whenever possible rather than TABLE SCAN.
使用范围扫描和跳跃扫描,而不是表级别的扫描。
Filter against leading columns in the primary key constraint. This assumes you have designed the primary key to lead with frequently-accessed or frequently-filtered columns as described in “Primary Keys,” above.
对主导主键的列进行过滤。
If necessary, introduce a local index or a global index that covers your query.
如果可以的话,在你的查询语句中引入本地索引和全局索引覆盖在你的
If you have an index that covers your query but the optimizer is not detecting it, try hinting the query: SELECT /*+ INDEX() */ …
如果你的查询语句包含一索引,但是优化器,没有发现他,你可以试隐示使用select/*+index()*/ 指明
See also: http://phoenix.apache.org/language/index.html#explain

Anatomy of an Explain Plan
剖析 执行计划
An explain plan consists of lines of text that describe operations that Phoenix will perform during a query, using the following terms:
解释计划由Phoenix查询解释性执行的操作的文本行组成,使用以下术语:
AGGREGATE INTO ORDERED DISTINCT ROWS—aggregates the returned rows using an operation such as addition. 

列如使用加操作,就会返回聚合成不同有序的行。
When ORDERED is used, the GROUP BY operation is applied to the leading part of the primary key constraint, which allows the aggregation to be done in place rather than keeping all distinct groups in memory on the server side.
当使用ORDERED时,GROUP BY操作应用于主键约束的主要部分,这允许在适当的位置进行聚合,而不是将所有不同的组保存在服务器端内存中。
AGGREGATE INTO SINGLE ROW—aggregates the results into a single row using an aggregate function with no GROUP BY clause. 
不使用用group by 聚合函数,返回一行的聚合结果集
For example, the count() statement returns one row with the total number of rows that match the query.
例如:count 返回一行匹配查询条件总记录数
CLIENT—the operation will be performed on the client side. It’s faster to perform most operations on the server side, so you should consider whether there’s a way to rewrite the query to give the server more of the work to do.
CLIENT -操作将在客户端执行。在服务端执行会更快,因此你应该考虑重写使服务做更多的工作。
FILTER BY expression—returns only results that match the expression.
FLETER过滤器 只返回匹配表达式的结果
FULL SCAN OVER tableName—the operation will scan every row in the specified table.
全表扫描,这个操作会扫描指定表的每一行
INNER-JOIN—the operation will join multiple tables on rows where the join condition is met.
内连接-这个操作使用关联条件,关联多个表
MERGE SORT—performs a merge sort on the results.
合并排序-对结果集进行合并排序
RANGE SCAN OVER tableName [ … ]—The information in the square brackets indicates the start and stop for each primary key that’s used in the query.
对tablename 表进行范围扫描-方括号的信息表示,用于查询的开始和结束主键。
ROUND ROBIN—when the query doesn’t contain ORDER BY and therefore the rows can be returned in any order, ROUND ROBIN order maximizes parallelization on the client side.
ROUND ROBIN-当查询语句没有 order by 关键字,返回的行顺序会是随机的,轮询调度会再客户端最大并行的执行
x-CHUNK—describes how many threads will be used for the operation. The maximum parallelism is limited to the number of threads in thread pool. 
x-CHUNK-描述这个操作使用了多少个线程。线程池中最大的并行线程数。
The minimum parallelization corresponds to the number of regions the table has between the start and stop rows of the scan. The number of chunks will increase with a lower guidepost width, as there is more than one chunk per region.
表开始和结束行的之间,最小并行分区数。每一个分区有多个块,随着导柱宽度的减小,块的数量也会增加。
PARALLELx-WAY—describes how many parallel scans will be merge sorted during the operation.
PARALLELx-WAY-在操作期间将合并多少并行扫描会被归并排序。
SERIAL—some queries run serially. For example, a single row lookup or a query that filters on the leading part of the primary key and limits the results below a configurable threshold.
串行——有些查询是串行运行的。例如,在主键的前导部分进行筛选并将结果限制在可配置阈值以下的单个行查找或查询。
EST_BYTES_READ - provides an estimate of the total number of bytes that will be scanned as part of executing the query
提供执行查询的一部分扫描的总字节数的估计值
EST_ROWS_READ - provides an estimate of the total number of rows that will be scanned as part of executing the query
提供执行查询的一部分扫描的行总数的估计值
EST_INFO_TS - epoch time in milliseconds at which the estimate information was collected
以毫秒为单位的元时间,评估信息收集时间。
Example
+-----------------------------------------------------------------------------------------------------------------------------------
|                                            PLAN                                 | EST_BYTES_READ  | EST_ROWS_READ  | EST_INFO_TS  |
+-----------------------------------------------------------------------------------------------------------------------------------
| CLIENT 36-CHUNK 237878 ROWS 6787437019 BYTES PARALLEL 36-WAY FULL SCAN
| OVER exDocStoreb                                                                |     237878      |   6787437019   | 1510353318102|
|   PARALLEL INNER-JOIN TABLE 0 (SKIP MERGE)                                      |     237878      |   6787437019   | 1510353318102|
|     CLIENT 36-CHUNK PARALLEL 36-WAY RANGE SCAN OVER indx_exdocb 
|      [0,' 42ecf4abd4bd7e7606025dc8eee3de 6a3cc04418cbc2619ddc01f54d88d7 c3bf'] 
|      - [0,' 42ecf4abd4bd7e7606025dc8eee3de 6a3cc04418cbc2619ddc01f54d88d7 c3bg' |     237878      |   6787437019   | 1510353318102|
|       SERVER FILTER BY FIRST KEY ONLY                                           |     237878      |   6787437019   | 1510353318102|
|       SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY ["ID"]                     |     237878      |   6787437019   | 1510353318102|
|     CLIENT MERGE SORT                                                           |     237878      |   6787437019   | 1510353318102|
|   DYNAMIC SERVER FILTER BY (A.CURRENT_TIMESTAMP, [A.ID](http://a.id/)) 
    IN ((TMP.MCT, TMP.TID))                                                       |     237878      |   6787437019   | 1510353318102|
+-----------------------------------------------------------------------------------------------------------------------------------
JDBC Explain Plan API and the estimates information
The information displayed in the explain plan API can also be accessed programmatically through the standard JDBC interfaces. When statistics collection is enabled for a table, the explain plan also gives an estimate of number of rows and bytes a query is going to scan. To get hold of the info, you can use corresponding columns in the result set returned by the explain plan statement. When stats collection is not enabled or if for some reason Phoenix cannot provide the estimate information, the columns return null. Below is an example:

String explainSql = "EXPLAIN SELECT * FROM T";
Long estimatedBytes = null;
Long estimatedRows = null;
Long estimateInfoTs = null;
try (Statement statement = conn.createStatement(explainSql)) {
        int paramIdx = 1;
        ResultSet rs = statement.executeQuery(explainSql);
        rs.next();
        estimatedBytes =
                (Long) rs.getObject(PhoenixRuntime.EXPLAIN_PLAN_ESTIMATED_BYTES_READ_COLUMN);
        estimatedRows =
                (Long) rs.getObject(PhoenixRuntime.EXPLAIN_PLAN_ESTIMATED_ROWS_READ_COLUMN);
        estimateInfoTs =
                (Long) rs.getObject(PhoenixRuntime.EXPLAIN_PLAN_ESTIMATE_INFO_TS_COLUMN);
}

https://phoenix.apache.org/explainplan.html

翻译不准确的地方,还请大家指正,谢谢

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/423274.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【C++深度剖析教程17】逻辑操作符的陷阱

今天我们来学习逻辑操作符,那么什么是逻辑操作符的陷阱呢?在讲解逻辑操作符陷阱之前,我们先来回顾什么是逻辑操作符: 逻辑运算符的原生语义: -操作数只有两种值(true和false) -逻辑表达式不用…

【移植Linux 3.4.2内核之四】修改内核代码支持YAFFS文件系统

上一篇文章,我们从0制作jffs2文件系统,因为我们的内核本身就支持iffs2文件系统,但是它不支持yaffs文件系统。今天我们就来修改内核代码,让内核支持yaffs文件系统的格式。 1.首先我们获取yaffs源码 我是通过git获得,当…

通过split命令分割大文件

场景 1.线上出了问题,我需要去查找log来定位问题,但是由于线上数据量庞大,这些log文件每过一个小时就会自动回滚一次,尽管如此,有的log文件依然达到了五六g以上的大小。 对于这种巨大的log文件,常用的一些…

一个简单的 Generic Factory 类

简单的工厂类的一个使用场景是, 假设有一个基类 BaseClass, 和一系列的子类 A, B, C, 工厂类根据某个参数,例如字符串 “A”, “B”, “C” 创建出相应的子类。 举例如下: public class Factory…

【移植驱动到Linux3.4.2内核之一】移植DM9000C网卡驱动

学习交流加 个人qq: 1126137994个人微信: liu1126137994学习交流资源分享qq群: 962535112 之前已经把uboot,内核,文件系统,都移植好了,今天开始我们把第二期写的Linux2.6.22.6内核的驱动程序全部…

位运算实现一些小算法

package com.asiainfo.cem_volte_hbase;/*** ClassName Test* Description 有意思的小算法* Author qianxl* Date 2019-08-02 17:34* Version 1.0**/ public class Test {/*** * param num1 * param num2* description: 写一个函数,求两个整数之和,要求…

关于dhtmlxScheduler的使用说明(ADD EDIT DEL,自定义CelendarBox)

由于比较多朋友询问我的使用问题,所以写一篇简单的使用说明: 可以看回以前相关的文章: 基于dhtmlxScheduler的个人计划... 探讨:OA系统的设计问题. weebox[ PopUp - 弹出窗 对话框 ]weebox是一个基于jquery的弹窗插件dhtmlxScheduler[ Cale…

【移植驱动到Linux3.4.2内核之二】LCD,触摸屏,按键,USB等驱动程序的移植心得总结

学习交流加 个人qq: 1126137994个人微信: liu1126137994学习交流资源分享qq群: 962535112 文章目录一移植驱动程序心得体会二移植LCD驱动程序记录三移植按键输入子系统驱动程序四移植触摸屏驱动程序五移植USB驱动程序今天移植了按键&#xff…

idea 解决jar 的冲突

1.maven 组件会自动去除重复的jar 注意!灰色是去重的jar ,实体颜色是使用的jar; 2.springboot 关于 Class path contains multiple SLF4J bindings.警告的解决 2.1查询jar的依赖结构: 查询出slf4j-log4j12 查询到然后执行exclude https://blog.csdn.ne…

永远要跟比你更成功的人在一起

永远要跟比你更成功的人在一起 (本文只有在月09日可以学习到。) 在你的朋友圈中,如果你是最成功的那一个,你就不会更成功了。 别怕与大人物打交道。最成功的人都是那些最容易与别人相处打交道的人,当你总是与最顶尖的人在一起时,你…

【C++深度剖析教程18】逗号操作符的分析

今天来学习C中的逗号操作符。那么什么是逗号操作符呢? *逗号操作符(,)可以构成逗号表达式 逗号表达式用于将多个子表达式连接为一个表达式逗号表达式的值为最后一个子表达式的值逗号表达式的前N-1个表达式的值可以没有返回值逗号…

UML 模型

1.五分钟读懂UML类图 https://blog.csdn.net/soft_zzti/article/details/79811923

CRM软件设计评测点与采集测评点

系统架构 在这部分,我们首先会验证参测产品的开发平台以及支持的客户端种类等情况,以便于用户的IT部门了解这些产品的技术基础。同时我们也会考察产品与第 三方管理系统交互的能力,比如是否支持按照各种常见客户信息管理应用的数据格式进行导…

【C++深度剖析教程19】前置操作符与后置操作符

今天来学习C中的前置操作符(i)与后置操作符(i)。 一回顾 以前在C语言的理论课程中,我们就学过,前置和后置操作符,有一定的区别: 但是我们可以看到下图,发现前置和后…

吞吐量(TPS)、QPS、并发数、响应时间(RT)

开发的原因,需要对吞吐量(TPS)、QPS、并发数、响应时间(RT)几个概念做下了解,查自百度百科,记录如下: 1. 响应时间(RT)   响应时间是指系统对请求作出响应的时间。直观上看&#…

【C++的深度剖析教程20】类型转换函数上

今天来学习类型转换函数。 一回顾 我们学习C语言的时候,都知道,标准的数据类型之间,是可以做类型的转换的。分为隐式类型转换和强制类型转换。那么强制类型转换呢,比较简单。但是隐式类型转换,却存在诸多问题。下面我…

【C++的深度剖析教程21】类型转换函数下

上一篇文章写了关于普通类型转换为类类型的语法与性质,今天我们来看一下:类类型如何转换为普通类型。 一、类型转换函数: C类中,可以定义类型转换函数,类型转换函数用于将类对象转换为其他类型。 语法规则&#xff…

JQuery技巧(转)

转自http://www.cnblogs.com/top5/archive/2010/01/17/1649984.html1.禁用右键菜单$(document).ready(function(){$(document).bind("contextmenu",function(e){return false;});});2.让字体闪烁jQuery.fn.flash function( color, duration ){var current this.css…

自定义链表增,删除,链表逆序

工作时间长了,经常用框架,感觉真的成了coding,建议有时间可以刷一下lettcode 时间一长就会忘,写了大半天,记录一下,理解后再写特别简单,链表逆序看了很多博客,写法各式各样,但是感觉…