如何理解HAWQ中的entryDB

时间:2016-06-28 09:10:40

标签: hawq

HAWQ中的entryDB是什么?在master中的entryDB进程和在段中的Query Executor进程之间有什么区别?在entryDB上运行什么类型的查询?

2 个答案:

答案 0 :(得分:1)

EntryDB是一种在主节点上调度的查询执行器。 EntryDB和QE之间的区别在于EntryDB能够访问主目录。通常将udf分派给EntryDB。

答案 1 :(得分:1)

有时计划在entrydb上执行UDF或涉及的串行查询。实际上,可能会将UDF / serial分派到QD / QE / EntryDB并在不同的计划中进行处理。

这是一个串行示例。如您所见,它在使用orca / planner的计划中明确使用了entrydb。

CREATE TABLE some_vectors (
    id SERIAL,
    x FLOAT8[]
);
NOTICE:  CREATE TABLE will create implicit sequence "some_vectors_id_seq" for serial column "some_vectors.id"
CREATE TABLE

INSERT INTO some_vectors(x) VALUES
(ARRAY[1,0,0,0]),
(ARRAY[0,1,0,0]),
(ARRAY[0,0,1,0]),
(ARRAY[0,0,0,2]);


SET optimizer = on;
SET

EXPLAIN ANALYZE INSERT INTO some_vectors(x) VALUES                                                                                                                                                                           (ARRAY[1,0,0,0]),                                                                                                                                                                                                                     (ARRAY[0,1,0,0]),                                                                                                                                                                                                                     (ARRAY[0,0,1,0]),                                                                                                                                                                                                                     (ARRAY[0,0,0,2]);
                                                                                                                                                                                                  QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Insert  (cost=0.00..0.31 rows=4 width=12)
   Rows out:  Avg 4.0 rows x 1 workers.  Max/Last(seg0:rhuo-mbp/seg0:rhuo-mbp) 4/4 rows with 7.320/7.320 ms to first row, 7.331/7.331 ms to end, start offset by 1.718/1.718 ms.
   Executor memory:  1K bytes.
   ->  Redistribute Motion 1:1  (slice1)  (cost=0.00..0.00 rows=4 width=20)
         Rows out:  Avg 4.0 rows x 1 workers at destination.  Max/Last(seg0:rhuo-mbp/seg0:rhuo-mbp) 4/4 rows with 1.044/1.044 ms to first row, 1.046/1.046 ms to end, start offset by 1.718/1.718 ms.
         ->  Assert  (cost=0.00..0.00 rows=4 width=20)
               Assert Cond: NOT id IS NULL
               Rows out:  Avg 4.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 4/4 rows with 0.577/0.577 ms to first row, 0.824/0.824 ms to end, start offset by 1.826/1.826 ms.
               Executor memory:  1K bytes.
               ->  Result  (cost=0.00..0.00 rows=4 width=20)
                     Rows out:  Avg 4.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 4/4 rows with 0.569/0.569 ms to first row, 0.815/0.815 ms to end, start offset by 1.826/1.826 ms.
                     ->  Append  (cost=0.00..0.00 rows=4 width=8)
                           Rows out:  Avg 4.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 4/4 rows with 0.360/0.360 ms to first row, 0.402/0.402 ms to end, start offset by 1.827/1.827 ms.
                           ->  Result  (cost=0.00..0.00 rows=1 width=8)
                                 Rows out:  Avg 1.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 1/1 rows with 0.359/0.359 ms to first row, 0.360/0.360 ms to end, start offset by 1.827/1.827 ms.
                                 ->  Result  (cost=0.00..0.00 rows=1 width=1)
                                       Rows out:  Avg 1.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 1/1 rows with 0/0 ms to end, start offset by 1.827/1.827 ms.
                           ->  Result  (cost=0.00..0.00 rows=1 width=8)
                                 Rows out:  Avg 1.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 1/1 rows with 0.015/0.015 ms to end, start offset by 2.411/2.411 ms.
                                 ->  Result  (cost=0.00..0.00 rows=1 width=1)
                                       Rows out:  Avg 1.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 1/1 rows with 0/0 ms to end, start offset by 2.411/2.411 ms.
                           ->  Result  (cost=0.00..0.00 rows=1 width=8)
                                 Rows out:  Avg 1.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 1/1 rows with 0.012/0.012 ms to end, start offset by 2.500/2.500 ms.
                                 ->  Result  (cost=0.00..0.00 rows=1 width=1)
                                       Rows out:  Avg 1.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 1/1 rows with 0/0 ms to end, start offset by 2.500/2.500 ms.
                           ->  Result  (cost=0.00..0.00 rows=1 width=8)
                                 Rows out:  Avg 1.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 1/1 rows with 0.013/0.013 ms to end, start offset by 2.581/2.581 ms.
                                 ->  Result  (cost=0.00..0.00 rows=1 width=1)
                                       Rows out:  Avg 1.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 1/1 rows with 0/0 ms to end, start offset by 2.581/2.581 ms.
 Slice statistics:
   (slice0)    Executor memory: 323K bytes (seg0:rhuo-mbp).
   (slice1)    Executor memory: 279K bytes (entry db).
 Statement statistics:
   Memory used: 262144K bytes
 Settings:  default_hash_table_bucket_number=6; optimizer=on
 Optimizer status: PQO version 1.633
 Dispatcher statistics:
   executors used(total/cached/new connection): (2/2/0); dispatcher time(total/connection/dispatch data): (0.120 ms/0.000 ms/0.033 ms).
   dispatch data time(max/min/avg): (0.026 ms/0.005 ms/0.015 ms); consume executor data time(max/min/avg): (0.023 ms/0.013 ms/0.018 ms); free executor time(max/min/avg): (0.000 ms/0.000 ms/0.000 ms).
 Data locality statistics:
   data locality ratio: 1.000; virtual segment number: 1; different host number: 1; virtual segment number per host(avg/min/max): (1/1/1); segment size(avg/min/max): (560.000 B/560 B/560 B); segment size with penalty(avg/min/max): (560.000 B/560 B/560 B); continuity(avg/min/max): (1.000/1.000/1.000); DFS metadatacache: 6.804 ms; resource allocation: 0.549 ms; datalocality calculation: 0.083 ms.
 Total runtime: 31.656 ms
(42 rows)

SET optimizer = off;
SET

EXPLAIN ANALYZE INSERT INTO some_vectors(x) VALUES                                                                                                                                                                           (ARRAY[1,0,0,0]),                                                                                                                                                                                                                     (ARRAY[0,1,0,0]),                                                                                                                                                                                                                     (ARRAY[0,0,1,0]),                                                                                                                                                                                                                     (ARRAY[0,0,0,2]);
                                                                                                                                                                                                  QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Insert (slice0; segments: 1)  (rows=4 width=32)
   ->  Redistribute Motion 1:1  (slice1)  (cost=0.00..0.07 rows=4 width=32)
         Rows out:  Avg 4.0 rows x 1 workers at destination.  Max/Last(seg0:rhuo-mbp/seg0:rhuo-mbp) 4/4 rows with 1.212/1.212 ms to first row, 1.215/1.215 ms to end, start offset by 1.643/1.643 ms.
         ->  Values Scan on "*VALUES*"  (cost=0.00..0.07 rows=4 width=32)
               Rows out:  Avg 4.0 rows x 1 workers.  Max/Last(seg-1:rhuo-mbp/seg-1:rhuo-mbp) 4/4 rows with 0.628/0.628 ms to first row, 0.888/0.888 ms to end, start offset by 1.848/1.848 ms.
 Slice statistics:
   (slice0)    Executor memory: 255K bytes (seg0:rhuo-mbp).
   (slice1)    Executor memory: 201K bytes (entry db).
 Statement statistics:
   Memory used: 262144K bytes
 Settings:  default_hash_table_bucket_number=6; optimizer=off
 Optimizer status: legacy query optimizer
 Dispatcher statistics:
   executors used(total/cached/new connection): (2/2/0); dispatcher time(total/connection/dispatch data): (0.118 ms/0.000 ms/0.025 ms).
   dispatch data time(max/min/avg): (0.018 ms/0.006 ms/0.012 ms); consume executor data time(max/min/avg): (0.723 ms/0.022 ms/0.372 ms); free executor time(max/min/avg): (0.000 ms/0.000 ms/0.000 ms).
 Data locality statistics:
   data locality ratio: 1.000; virtual segment number: 1; different host number: 1; virtual segment number per host(avg/min/max): (1/1/1); segment size(avg/min/max): (280.000 B/280 B/280 B); segment size with penalty(avg/min/max): (280.000 B/280 B/280 B); continuity(avg/min/max): (1.000/1.000/1.000); DFS metadatacache: 0.053 ms; resource allocation: 0.560 ms; datalocality calculation: 0.073 ms.
 Total runtime: 33.478 ms
(18 rows)