码迷,mamicode.com
首页 > 其他好文 > 详细

基于Phoenix对HBase建索引

时间:2019-07-17 20:37:54      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:cond   div   com   server   parallel   操作   url   hbase查询   read   

参考:

Phoenix与HBase集成进行数据分析

HBase查询速度慢原因排查

 

在DBeaver中执行下列语句:

select * from ASSET_NORMAL WHERE ASSET_ID=19-1151444153020846080;

返回信息:

3d8f2cf978094a47b2f24dea58fa697c    19-1151444153020846080    电脑    1001005    信息设备    1001005002 ……

如下:

技术图片

在DBeaver中执行下列语句:

select count(*) from ASSET_NORMAL;

返回信息:

10,614

如下:

技术图片

在DBeaver中执行下列语句:

explain select count(*) from ASSET_NORMAL;

返回信息:

CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER IDX_ASSET_NORMAL
    SERVER FILTER BY FIRST KEY ONLY
    SERVER AGGREGATE INTO SINGLE ROW
CLIENT 200 ROW LIMIT

如下:

技术图片

在DBeaver中执行下列语句:

explain select * from ASSET_NORMAL WHERE ASSET_ID=19-1151444153020846080;

返回信息:

CLIENT 1-CHUNK 200 ROWS 177000 BYTES SERIAL 1-WAY ROUND ROBIN RANGE SCAN OVER IDX_ASSET_NORMAL [‘19-1151444153020846080‘]    177000    200    0
    SERVER FILTER BY FIRST KEY ONLY    177000    200    0
    SERVER 200 ROW LIMIT    177000    200    0
CLIENT 200 ROW LIMIT    177000    200    0

如下:

技术图片

直接通过Bash进行操作,执行下列语句:

select count(*) from ASSET_NORMAL;

耗时0.071s,返回如下信息:

0: jdbc:phoenix:node3:2181:/hbase> select count(*) from ASSET_NORMAL;
+-----------+
| COUNT(1)  |
+-----------+
| 11286     |
+-----------+
1 row selected (0.071 seconds)

执行下列语句:

explain select count(*) from ASSET_NORMAL;

耗时0.03s,返回如下信息:

0: jdbc:phoenix:node3:2181:/hbase> explain select count(*) from ASSET_NORMAL;
+----------------------------------------------------------------+-----------------+----------------+--------------+
|                              PLAN                              | EST_BYTES_READ  | EST_ROWS_READ  | EST_INFO_TS  |
+----------------------------------------------------------------+-----------------+----------------+--------------+
| CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER IDX_ASSET_NORMAL  | null            | null           | null         |
|     SERVER FILTER BY FIRST KEY ONLY                            | null            | null           | null         |
|     SERVER AGGREGATE INTO SINGLE ROW                           | null            | null           | null         |
+----------------------------------------------------------------+-----------------+----------------+--------------+
3 rows selected (0.03 seconds)

执行下列语句:

select * from ASSET_NORMAL WHERE ASSET_ID=19-1151444153020846080;

耗时0.359s,返回如下信息:

0: jdbc:phoenix:node3:2181:/hbase> select * from ASSET_NORMAL WHERE ASSET_ID=19-1151444153020846080;
+-----------------------------------+-------------------------+-------------+------------------------+--------------------------+----------------+
|                ID                 |        ASSET_ID         | ASSET_NAME  | ASSET_FIRST_DEGREE_ID  | ASSET_FIRST_DEGREE_NAME  | ASSET_SECOND_D |
+-----------------------------------+-------------------------+-------------+------------------------+--------------------------+----------------+
| 3d8f2cf978094a47b2f24dea58fa697c  | 19-1151444153020846080  | 电脑          | 1001005                | 信息设备                     | 1001005002     |
+-----------------------------------+-------------------------+-------------+------------------------+--------------------------+----------------+
1 row selected (0.359 seconds)

执行下列语句:

explain select * from ASSET_NORMAL WHERE ASSET_ID=19-1151444153020846080;

耗时0.025s,返回如下信息:

0: jdbc:phoenix:node3:2181:/hbase> explain select * from ASSET_NORMAL WHERE ASSET_ID=19-1151444153020846080;
+--------------------------------------------------------------------------------------------------------+-----------------+----------------+----+
|                                                  PLAN                                                  | EST_BYTES_READ  | EST_ROWS_READ  | ES |
+--------------------------------------------------------------------------------------------------------+-----------------+----------------+----+
| CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER IDX_ASSET_NORMAL [19-1151444153020846080]  | null            | null           | nu |
|     SERVER FILTER BY FIRST KEY ONLY                                                                    | null            | null           | nu |
+--------------------------------------------------------------------------------------------------------+-----------------+----------------+----+
2 rows selected (0.025 seconds)

如下:

技术图片

 

基于Phoenix对HBase建索引

标签:cond   div   com   server   parallel   操作   url   hbase查询   read   

原文地址:https://www.cnblogs.com/ratels/p/11203313.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!