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

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

系統(tǒng) 2832 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元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

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

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 英吉沙县| 佛学| 内江市| 武城县| 石河子市| 虹口区| 新余市| 武山县| 会宁县| 东兰县| 杨浦区| 汉沽区| 威远县| 前郭尔| 襄城县| 通州区| 枣庄市| 吴堡县| 体育| 莒南县| 陇西县| 唐山市| 济源市| 洪洞县| 静安区| 通许县| 鄢陵县| 辽阳市| 浦城县| 阜阳市| 舞阳县| 鄂尔多斯市| 丹凤县| 罗山县| 江都市| 镇宁| 安乡县| 九台市| 浦县| 大庆市| 临泉县|