PostgresQL FDW 源码分析之 postgresGetForeignPlan()
2016-07-02 22:33
363 查看
进入 postgresGetForeignPlan()
根据在 GetForeignRelSize() 中处理获得的 attrs_used 构造要发送到 remote 端的 SQL 语句,其中包括 targetList 和 local_conds 中提到的属性,然后加上属于 remote_conds 的 where 限制条件。
将构造的 SQL 语句存入 ForeignScan 结构体的 fdw_private 中,在之后的 executor 执行器时使用。
根据在 GetForeignRelSize() 中处理获得的 attrs_used 构造要发送到 remote 端的 SQL 语句,其中包括 targetList 和 local_conds 中提到的属性,然后加上属于 remote_conds 的 where 限制条件。
/* * Build the query string to be sent for execution, and identify * expressions to be sent as parameters. */ initStringInfo(&sql); deparseSelectSql(&sql, root, baserel, fpinfo->attrs_used, &retrieved_attrs); if (remote_conds) appendWhereClause(&sql, root, baserel, remote_conds, true, ¶ms_list);
将构造的 SQL 语句存入 ForeignScan 结构体的 fdw_private 中,在之后的 executor 执行器时使用。
/* * Build the fdw_private list that will be available to the executor. * Items in the list must match enum FdwScanPrivateIndex, above. */ fdw_private = list_make2(makeString(sql.data), retrieved_attrs);
/* * Create the ForeignScan node from target list, local filtering * expressions, remote parameter expressions, and FDW private information. * * Note that the remote parameter expressions are stored in the fdw_exprs * field of the finished plan node; we can't keep them in private state * because then they wouldn't be subject to later planner processing. */ return make_foreignscan(tlist, local_exprs, scan_relid, params_list, fdw_private, NIL, /* no custom tlist */ remote_exprs, outer_plan);
相关文章推荐
- Android之获取手机上的图片和视频缩略图thumbnails
- 从源码安装Mysql/Percona 5.5
- 数据库链接字符串查询网站
- DB2实例管理
- DB2实例管理
- 保障MySQL数据安全的14个最佳方法
- mysql问答汇集
- 第三章 数据库备份和还原
- 创建一个空的IBM DB2 ECO数据库的方法
- Access 2000 数据库 80 万记录通用快速分页类
- 开通一个数据库失败的原因的和解决办法
- 一个简单的asp数据库操作类
- CentOS下DB2数据库安装过程详解
- PostgreSQL新手入门教程
- EasyASP v1.5发布(包含数据库操作类,原clsDbCtrl.asp)第1/2页
- PostgreSQL教程(十):性能提升技巧
- PostgreSQL教程(二):模式Schema详解
- PostgreSQL教程(十三):数据库管理详解