日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

PostgreSQL代碼分析,查詢優(yōu)化部分,pull_ands(

系統(tǒng) 2585 0

PostgreSQL代碼分析,查詢優(yōu)化部分。


這里把規(guī)范謂詞表達(dá)式的部分就整理完了,閱讀的順序例如以下:

一、PostgreSQL代碼分析,查詢優(yōu)化部分,canonicalize_qual

二、PostgreSQL代碼分析,查詢優(yōu)化部分,pull_ands()和pull_ors()

三、 PostgreSQL代碼分析,查詢優(yōu)化部分,process_duplicate_ors


*************************************************************************************************************************************************************


pull_ands()和pull_ors()的代碼比較便于理解,就是把樹狀結(jié)構(gòu)的AND操作拉平,下圖是pull_ands的樣例,pull_ors邏輯同樣:


PostgreSQL代碼分析,查詢優(yōu)化部分,pull_ands()和pull_ors()


      /*
 * pull_ands
 *	  Recursively flatten nested AND clauses into a single and-clause list.
 *
 * Input is the arglist of an AND clause.
 * Returns the rebuilt arglist (note original list structure is not touched).
 */
static List *
pull_ands(List *andlist)
{
	List	   *out_list = NIL;
	ListCell   *arg;

	foreach(arg, andlist)
	{
		Node	   *subexpr = (Node *) lfirst(arg);

		/*
		 * Note: we can destructively concat the subexpression's arglist
		 * because we know the recursive invocation of pull_ands will have
		 * built a new arglist not shared with any other expr. Otherwise we'd
		 * need a list_copy here.
		 */
		if (and_clause(subexpr))
			out_list = list_concat(out_list,
								   pull_ands(((BoolExpr *) subexpr)->args));
		else
			out_list = lappend(out_list, subexpr);
	}
	return out_list;
}

/*
 * pull_ors
 *	  Recursively flatten nested OR clauses into a single or-clause list.
 *
 * Input is the arglist of an OR clause.
 * Returns the rebuilt arglist (note original list structure is not touched).
 */
static List *
pull_ors(List *orlist)
{
	List	   *out_list = NIL;
	ListCell   *arg;

	foreach(arg, orlist)
	{
		Node	   *subexpr = (Node *) lfirst(arg);

		/*
		 * Note: we can destructively concat the subexpression's arglist
		 * because we know the recursive invocation of pull_ors will have
		 * built a new arglist not shared with any other expr. Otherwise we'd
		 * need a list_copy here.
		 */
		if (or_clause(subexpr))
			out_list = list_concat(out_list,
								   pull_ors(((BoolExpr *) subexpr)->args));
		else
			out_list = lappend(out_list, subexpr);
	}
	return out_list;
}
    

張大明確的blog:http://blog.csdn.net/shujiezhang


PostgreSQL代碼分析,查詢優(yōu)化部分,pull_ands()和pull_ors()


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 五河县| 永胜县| 彭水| 泾阳县| 嘉兴市| 建湖县| 瑞金市| 巴彦县| 昭苏县| 皮山县| 漠河县| 彩票| 灵川县| 湖州市| 富民县| 望都县| 河源市| 阿坝| 奉新县| 新建县| 阿克苏市| 饶平县| 赣州市| 手游| 桓台县| 保山市| 渝北区| 淳化县| 仁布县| 潞西市| 金秀| 盐源县| 临澧县| 青州市| 洛南县| 遂溪县| 宁安市| 清镇市| 漾濞| 揭阳市| 深水埗区|