0

What is entryDB in HAWQ? What are the differences between entryDB process in master and Query Executor process in segment? And what kind of queries are running on entryDB?

2 Answers2

1

EntryDB is a kind of query executor dispatched on master node. The difference between EntryDB and QE in segment is that EntryDB is able to access master catalog. Usually udf is dispatched to EntryDB.

ztao1987
  • 71
  • 7
1

The query with UDF or serial involved is sometimes planned to be executed on entrydb. Actually, UDF/serial might be dispatched to QD/QE/EntryDB and processed there in different plan.

Here is an example with serial. As you can see, it uses entrydb explicitly in both plan with orca/planner.

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)
huor
  • 116
  • 4