内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

PostgreSQL在執(zhí)行邏輯優(yōu)化中相關(guān)的數(shù)據(jù)結(jié)構(gòu)有哪些

這篇文章主要介紹“PostgreSQL在執(zhí)行邏輯優(yōu)化中相關(guān)的數(shù)據(jù)結(jié)構(gòu)有哪些”,在日常操作中,相信很多人在PostgreSQL在執(zhí)行邏輯優(yōu)化中相關(guān)的數(shù)據(jù)結(jié)構(gòu)有哪些問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”PostgreSQL在執(zhí)行邏輯優(yōu)化中相關(guān)的數(shù)據(jù)結(jié)構(gòu)有哪些”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、建始網(wǎng)絡(luò)推廣、微信小程序、建始網(wǎng)絡(luò)營(yíng)銷、建始企業(yè)策劃、建始品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供建始建站搭建服務(wù),24小時(shí)服務(wù)熱線:028-86922220,官方網(wǎng)址:www.rwnh.cn

PostgreSQL在執(zhí)行邏輯優(yōu)化中相關(guān)的數(shù)據(jù)結(jié)構(gòu)包括RangeSubselect/Alias/RangeVar/ResTarget/ColumnRef.

一、數(shù)據(jù)結(jié)構(gòu)

RangeSubselect
出現(xiàn)在FROM語(yǔ)句中的子查詢

/*
 * RangeSubselect - subquery appearing in a FROM clause
 * 出現(xiàn)在FROM語(yǔ)句中的子查詢
 */
typedef struct RangeSubselect
{
  NodeTag   type;
  //是否有LATERAL?
  bool    lateral;    /* does it have LATERAL prefix? */
  //未轉(zhuǎn)換的子查詢語(yǔ)句
  Node     *subquery;   /* the untransformed sub-select clause */
  //表別名和可選的列別名
  Alias    *alias;      /* table alias & optional column aliases */
} RangeSubselect;

Alias
為RangeVar指定別名.別名可能同時(shí)重命名了表列.

/*
 * Alias -
 *    specifies an alias for a range variable; the alias might also
 *    specify renaming of columns within the table.
 *    為RangeVar指定別名.別名可能同時(shí)重命名了表列.
 *
 * Note: colnames is a list of Value nodes (always strings).  In Alias structs
 * associated with RTEs, there may be entries corresponding to dropped
 * columns; these are normally empty strings ("").  See parsenodes.h for info.
 * 注意:colnames是Value節(jié)點(diǎn)(通常是字符串)鏈表.
 *      在與RTEs相關(guān)的Alias結(jié)構(gòu)體中,可能有跟已刪除的列對(duì)應(yīng)的條目.
 *    這些通常是空字符串("").詳細(xì)可參考parsenodes.h
 */
typedef struct Alias
{
  NodeTag   type;
  //別名
  char     *aliasname;    /* aliased rel name (never qualified) */
  //列別名鏈表
  List     *colnames;   /* optional list of column aliases */
} Alias;

RangeVar
range variable,用于FROM語(yǔ)句中.

/*
 * RangeVar - range variable, used in FROM clauses
 * range variable,用于FROM語(yǔ)句中.
 *
 * Also used to represent table names in utility statements; there, the alias
 * field is not used, and inh tells whether to apply the operation
 * recursively to child tables.  In some contexts it is also useful to carry
 * a TEMP table indication here.
 * 在工具語(yǔ)句中,用于表示表名,這時(shí)alias字段沒(méi)有使用.
 * inh用于判斷是否在子表中遞歸應(yīng)用相關(guān)的操作.
 */
typedef struct RangeVar
{
  NodeTag   type;
  char     *catalogname;  /* the catalog (database) name, or NULL */
  char     *schemaname;   /* the schema name, or NULL */
  char     *relname;    /* the relation/sequence name */
  bool    inh;      /* expand rel by inheritance? recursively act
                 * on children? */
  char    relpersistence; /* see RELPERSISTENCE_* in pg_class.h */
  Alias    *alias;      /* table alias & optional column aliases */
  int     location;   /* token location, or -1 if unknown */
} RangeVar;

ResTarget
結(jié)果目標(biāo)列(用于先前已轉(zhuǎn)換的解析樹(shù)的目標(biāo)鏈表中)

/*
 * ResTarget -
 *    result target (used in target list of pre-transformed parse trees)
 *    結(jié)果目標(biāo)列(用于先前已轉(zhuǎn)換的解析樹(shù)的目標(biāo)鏈表中)
 *
 * In a SELECT target list, 'name' is the column label from an
 * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the
 * value expression itself.  The 'indirection' field is not used.
 * 在SELECT的目標(biāo)鏈表中,
 *   'name'是'AS ColumnLabel'語(yǔ)句中的列標(biāo)簽,如無(wú)則為NULL,
 *   'val'是value表達(dá)式本身.
 *   'indirection'未使用.
 *
 * INSERT uses ResTarget in its target-column-names list.  Here, 'name' is
 * the name of the destination column, 'indirection' stores any subscripts
 * attached to the destination, and 'val' is not used.
 * INSERT在target-column-names鏈表中使用ResTarget.
 * 這里'name'是目標(biāo)列名稱,'indirection'存儲(chǔ)了所有與目標(biāo)相關(guān)的子腳本,'val'未使用.
 *
 * In an UPDATE target list, 'name' is the name of the destination column,
 * 'indirection' stores any subscripts attached to the destination, and
 * 'val' is the expression to assign.
 * 在UPDATE目標(biāo)鏈表中,'name'是目標(biāo)列名稱,'indirection'存儲(chǔ)了所有與目標(biāo)相關(guān)的子腳本,
 * 'val'是與賦值相關(guān)的表達(dá)式.
 *
 * See A_Indirection for more info about what can appear in 'indirection'.
 * 詳細(xì)參見(jiàn)A_Indirection('indirection')
 */
typedef struct ResTarget
{
  NodeTag   type;
  //列名或NULL
  char     *name;     /* column name or NULL */
  //子腳本,字段名稱,'*'或NIL
  List     *indirection;  /* subscripts, field names, and '*', or NIL */
  //需要計(jì)算或賦值的值表達(dá)式
  Node     *val;      /* the value expression to compute or assign */
  //token的位置,-1表示未知
  int     location;   /* token location, or -1 if unknown */
} ResTarget;

ColumnRef
指定對(duì)列或整個(gè)元組的引用

/*
 * ColumnRef - specifies a reference to a column, or possibly a whole tuple
 * 指定對(duì)列或整個(gè)元組的引用
 *
 * The "fields" list must be nonempty.  It can contain string Value nodes
 * (representing names) and A_Star nodes (representing occurrence of a '*').
 * Currently, A_Star must appear only as the last list element --- the grammar
 * is responsible for enforcing this!
 * "fields"鏈表不能為空.可能包含字符串Value節(jié)點(diǎn)和A_Star節(jié)點(diǎn)(表示出現(xiàn)了*).
 * 截止到目前為止,A_Star必須出現(xiàn)在最后一個(gè)鏈表元素中.
 *
 * Note: any container subscripting or selection of fields from composite columns
 * is represented by an A_Indirection node above the ColumnRef.  However,
 * for simplicity in the normal case, initial field selection from a table
 * name is represented within ColumnRef and not by adding A_Indirection.
 */
typedef struct ColumnRef
{
  NodeTag   type;
  //字段名稱(字符串值)鏈表或A_Star
  List     *fields;     /* field names (Value strings) or A_Star */
  //token位置
  int     location;   /* token location, or -1 if unknown */
} ColumnRef;

二、源碼解讀

N/A

三、跟蹤分析

RangeSubselect/Alias

(gdb) p *(Node *)($stmt->fromClause->head.data->ptr_value)
$15 = {type = T_RangeSubselect} #實(shí)際類型是范圍子查詢RangeSubselect
(gdb) set $fromclause=(RangeSubselect *)($stmt->fromClause->head.data->ptr_value)
(gdb) p *$fromclause
$16 = {type = T_RangeSubselect, lateral = false, subquery = 0x1666c18, alias = 0x1666d40}
(gdb) p *($fromclause->subquery) #subquery,子查詢是SelectStmt類型的節(jié)點(diǎn)
$17 = {type = T_SelectStmt}
(gdb) p *($fromclause->alias) #alias,別名,實(shí)際值是字符串ret
$18 = {type = T_Alias, aliasname = 0x1666d28 "ret", colnames = 0x0}

RangeVar

...
$43 = {type = T_RangeVar}
(gdb) p *(RangeVar *)((JoinExpr *)($joinexpr->larg))->larg
$44 = {type = T_RangeVar, catalogname = 0x0, schemaname = 0x0, relname = 0x1643380 "t_dwxx", inh = true, 
  relpersistence = 112 'p', alias = 0x0, location = 82}
...

ResTarget

...
(gdb) p *(Node *)($subquerylarg->targetList->head.data->ptr_value)
$26 = {type = T_ResTarget}
(gdb) set $subvar=(ResTarget *)($subquerylarg->targetList->head.data->ptr_value)
(gdb) p *$subvar 
{type = T_ResTarget, name = 0x0, indirection = 0x0, val = 0x1642c70, location = 23}
...

ColumnRef

...
(gdb) p *$restarget->val
$25 = {type = T_ColumnRef}
(gdb) p *(ColumnRef *)$restarget->val
$26 = {type = T_ColumnRef, fields = 0x1a47a08, location = 7}
(gdb) p *((ColumnRef *)$restarget->val)->fields
$27 = {type = T_List, length = 2, head = 0x1a47a88, tail = 0x1a479e8}
(gdb) p *(Node *)(((ColumnRef *)$restarget->val)->fields)->head.data->ptr_value
$32 = {type = T_String}
#fields鏈表的第1個(gè)元素是數(shù)據(jù)表,第2個(gè)元素是數(shù)據(jù)列
(gdb) p *(Value *)(((ColumnRef *)$restarget->val)->fields)->head.data->ptr_value
$37 = {type = T_String, val = {ival = 27556248, str = 0x1a47998 "t_dwxx"}}
(gdb) p *(Value *)(((ColumnRef *)$restarget->val)->fields)->tail.data->ptr_value
$38 = {type = T_String, val = {ival = 27556272, str = 0x1a479b0 "dwmc"}}
...

到此,關(guān)于“PostgreSQL在執(zhí)行邏輯優(yōu)化中相關(guān)的數(shù)據(jù)結(jié)構(gòu)有哪些”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

網(wǎng)站名稱:PostgreSQL在執(zhí)行邏輯優(yōu)化中相關(guān)的數(shù)據(jù)結(jié)構(gòu)有哪些
文章轉(zhuǎn)載:http://www.rwnh.cn/article38/gopepp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、網(wǎng)站維護(hù)、建站公司、動(dòng)態(tài)網(wǎng)站、外貿(mào)建站、響應(yīng)式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開(kāi)發(fā)
攀枝花市| 荆州市| 安宁市| 武汉市| 浠水县| 天台县| 华容县| 金昌市| 商河县| 孟州市| 潢川县| 临桂县| 满洲里市| 南通市| 宜宾市| 东源县| 日照市| 武鸣县| 砀山县| 平湖市| 武汉市| 合阳县| 徐水县| 霍城县| 富源县| 延津县| 抚松县| 恭城| 盐山县| 西吉县| 青铜峡市| 志丹县| 广水市| 垣曲县| 兴隆县| 常宁市| 浮梁县| 贵州省| 息烽县| 社旗县| 麻江县|