2016-06-28 11 views
0

HAWQのentryDBとは何ですか?マスターのentryDBプロセスとセグメントのQuery Executorプロセスの違いは何ですか? entryDBでどのようなクエリが実行されていますか?HAWQのentryDBの理解方法

+0

entryDBとは何ですか? PGD​​ATABASE環境変数のようなデフォルトのデータベースを意味しますか? –

+0

@Jon Roberts En、私はそれが私が意味するものではないと思う。そして、ztao1987はHAWQのentryDBと言いました。 –

答えて

1

EntryDBは、マスターノードでディスパッチされる一種のクエリ実行者です。セグメント内のEntryDBとQEの違いは、EntryDBがマスターカタログにアクセスできることです。通常、udfはEntryDBにディスパッチされます。

+0

EntryDB上で実行されるクエリの例を挙げてください。 –

+0

generate_series関数をチェックすることができます。 – ztao1987

1

UDFまたはシリアルに関係するクエリは、entrydbで実行される予定です。実際には、UDF /シリアルは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) 
関連する問題