[Postgres-xl-developers] how is a query passed between a coordinator and a datanode?

Rui Hai Jiang ruihaijiang at msn.com
Tue Jun 23 05:52:44 PDT 2015


Hello,
I'm trying to figure out how a query and its result is passed between a coordinator and a datanode.   I know there are many messages passed between them to finish a query. 
 
I did a test against the coordinator by adding a row to a table and the sql was, insert into hg1(id, name) values(1,'tom'). 
I found a command 'P' was sent from the coordinator to a datanode and there was a remote statement as following,
 
stmt_name=p_1_25af_f
query_string=Remote Subplan
plan_string={REMOTESTMT :commandType 3 :hasReturning false :planTree {MODIFYTABLE :startup_cost 0.00 :total_cost 0.01 :plan_rows 1 :plan_width 0 :targetlist <> :qual <> :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :operation 3 :canSetTag true :resultRelations (i 1) :resultRelIndex 0 :plans ({REMOTESUBPLAN :startup_cost 0.00 :total_cost 0.01 :plan_rows 1 :plan_width 0 :targetlist ({TARGETENTRY :expr {CONST :consttype pg_catalog int4 :consttypmod -1 :constcollid <> <> -1 :constlen 4 :constbyval true :constisnull false :location 25 :constvalue \2} :resno 1 :resname id :ressortgroupref 0 :resorigtbl <> <> :resorigcol 0 :resjunk false} {TARGETENTRY :expr {CONST :consttype pg_catalog text :consttypmod -1 :constcollid pg_catalog default -1 :constlen -1 :constbyval false :constisnull false :location 27 :constvalue hello} :resno 2 :resname name :ressortgroupref 0 :resorigtbl <> <> :resorigcol 0 :resjunk false}) :qual <> :lefttree {RESULT :startup_cost 0.00 :total_cost 0.01 :plan_rows 1 :plan_width 0 :targetlist ({TARGETENTRY :expr {CONST :consttype pg_catalog int4 :consttypmod -1 :constcollid <> <> -1 :constlen 4 :constbyval true :constisnull false :location 25 :constvalue \2} :resno 1 :resname id :ressortgroupref 0 :resorigtbl <> <> :resorigcol 0 :resjunk false} {TARGETENTRY :expr {CONST :consttype pg_catalog text :consttypmod -1 :constcollid pg_catalog default -1 :constlen -1 :constbyval false :constisnull false :location 27 :constvalue hello} :resno 2 :resname name :ressortgroupref 0 :resorigtbl <> <> :resorigcol 0 :resjunk false}) :qual <> :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :resconstantqual <>} :righttree <> :initPlan <> :extParam (b) :allParam (b) :scanrelid 0 :distributionType R :distributionKey 0 :distributionNodes (i 0 1) :distributionRestrict (i 0 1) :nodeList (i 0) :execOnAll true :sort <> :cursor p_1_25af_e :unique 0}) :returningLists <> :rowMarks <> :epqParam 0} :rtable ({RTE :alias <> :eref {ALIAS :aliasname hg1 :colnames ("id" "name")} :rtekind 0 :relid public hg1 :relkind r :inh false :inFromCl false :requiredPerms 1 :checkAsUser 0 :selectedCols (b) :modifiedCols (b 10 11)}) :resultRelations (i 1) :subplans <> :nParamExec 1 :nParamRemote 0 :rowMarks <> :distributionType O :distributionKey 0 :distributionNodes <> :distributionRestrict <>}
 
My questions are,
1-does the coordinator use the remote statement to tell a datanode what to do? If so, how is the plan string created by the coordinator and how is the plan_string parsed by the datanode?
 
2-if there are multiple rows in the result of the query, how are the rows of data passed from the datanode to the coordinator? Does the datanode just send all the rows of data to the coordinator? or the coordinator get each row of data by sending a query?
 
Thank you very much!
Rui Hai 		 	   		  


More information about the Postgres-xl-developers mailing list