当前位置: 首页 > news >正文

php动态网站开发实例教程云搜索app下载

php动态网站开发实例教程,云搜索app下载,调用wordpress搜索代码,青岛哪里做网站1 前言 本文件的源码来自PostgreSQL 14.5,其它版本略有不同 PostgreSQL的并行workers是由compute_parallel_worker函数决定的,compute_parallel_worker是估算扫描所需的并行工作线程数,并不是您在postgresql.conf中设置的max_parallel_work…

1 前言

  • 本文件的源码来自PostgreSQL 14.5,其它版本略有不同

PostgreSQL的并行workers是由compute_parallel_worker函数决定的,compute_parallel_worker是估算扫描所需的并行工作线程数,并不是您在postgresql.conf中设置的max_parallel_workers_per_gather数量,compute_parallel_worker会根据heap_pages、index_pages、max_workers(max_parallel_workers_per_gather)来决定并行工作线程数量。

2 源码和调用位置

compute_parallel_worker共有4个地方调用

src\backend\optimizer\path\allpaths.c(801,21)
src\backend\optimizer\path\allpaths.c(3724,21)
src\backend\optimizer\path\costsize.c(707,33)
src\backend\optimizer\plan\planner.c(5953,21)

compute_parallel_worker的声明

src\include\optimizer\paths.h(59,12)

compute_parallel_worker的实现

src\backend\optimizer\path\allpaths.c(3750,1)

compute_parallel_worker的源码

/** Compute the number of parallel workers that should be used to scan a* relation.  We compute the parallel workers based on the size of the heap to* be scanned and the size of the index to be scanned, then choose a minimum* of those.** "heap_pages" is the number of pages from the table that we expect to scan, or* -1 if we don't expect to scan any.** "index_pages" is the number of pages from the index that we expect to scan, or* -1 if we don't expect to scan any.** "max_workers" is caller's limit on the number of workers.  This typically* comes from a GUC.* "max_workers"就是postgresql.conf中max_parallel_workers_per_gather的值*/
int
compute_parallel_worker(RelOptInfo *rel, double heap_pages, double index_pages,int max_workers)
{int			parallel_workers = 0;/** If the user has set the parallel_workers reloption, use that; otherwise* select a default number of workers.* 不需要优化,直接来自表级存储参数parallel_workers* 详见第3节直接使用postgresql.conf中设置的max_parallel_workers_per_gather数量*/if (rel->rel_parallel_workers != -1)parallel_workers = rel->rel_parallel_workers;else{/** If the number of pages being scanned is insufficient to justify a* parallel scan, just return zero ... unless it's an inheritance* child. In that case, we want to generate a parallel path here* anyway.  It might not be worthwhile just for this relation, but* when combined with all of its inheritance siblings it may well pay* off.*/if (rel->reloptkind == RELOPT_BASEREL &&((heap_pages >= 0 && heap_pages < min_parallel_table_scan_size) ||(index_pages >= 0 && index_pages < min_parallel_index_scan_size)))return 0;if (heap_pages >= 0){int			heap_parallel_threshold;int			heap_parallel_workers = 1;/** Select the number of workers based on the log of the size of* the relation.  This probably needs to be a good deal more* sophisticated, but we need something here for now.  Note that* the upper limit of the min_parallel_table_scan_size GUC is* chosen to prevent overflow here.*/heap_parallel_threshold = Max(min_parallel_table_scan_size, 1);while (heap_pages >= (BlockNumber) (heap_parallel_threshold * 3)){heap_parallel_workers++;heap_parallel_threshold *= 3;if (heap_parallel_threshold > INT_MAX / 3)break;		/* avoid overflow */}parallel_workers = heap_parallel_workers;}if (index_pages >= 0){int			index_parallel_workers = 1;int			index_parallel_threshold;/* same calculation as for heap_pages above */index_parallel_threshold = Max(min_parallel_index_scan_size, 1);while (index_pages >= (BlockNumber) (index_parallel_threshold * 3)){index_parallel_workers++;index_parallel_threshold *= 3;if (index_parallel_threshold > INT_MAX / 3)break;		/* avoid overflow */}if (parallel_workers > 0)parallel_workers = Min(parallel_workers, index_parallel_workers);elseparallel_workers = index_parallel_workers;}}/* In no case use more than caller supplied maximum number of workers */parallel_workers = Min(parallel_workers, max_workers);return parallel_workers;
}

3 直接使用postgresql.conf中设置的max_parallel_workers_per_gather数量

如果要使用指定数量的并行工作线程数,必须使用表级存储参数parallel_workers。

alter table tab set (parallel_workers=8);

注意:如果不设置表级存储参数parallel_workers,实际的并行工作线程数由compute_parallel_worker根据会根据heap_pages、index_pages、max_workers来决定并行工作线程数量。
因此会出现实际并行工作数量不等于postgresql.conf中设置的max_parallel_workers_per_gather数量的情况。

http://www.hrbkazy.com/news/19474.html

相关文章:

  • 大鹏网站建设公司百度seo排名查询
  • 网站图片切换怎么做网络销售怎么做才能有业务
  • 怎样买空间做网站seo网站关键词优化方式
  • wordpress网站重定向学技术的培训学校
  • 南昌公司网站开发社群营销方案
  • 网页设计实验报告实验分析宁波seo推广推荐
  • 国贸附近网站建设seo推广方法
  • 安卓开发和网站开发国内十大搜索引擎
  • wordpress使用ossseo推广培训费用
  • 网上挣钱快的路子seo修改器
  • 佛山企业网站多少钱网站seo查询
  • 漂亮的蓝色网站做seo网页价格
  • wordpress 安装 权限设置seo怎么收费
  • 福州交通建设集团官方网站北京seo公司wyhseo
  • 广东汽车品牌网站建设解释seo网站推广
  • 网站建设支出账务处理百度资源搜索资源平台
  • 网站建设公司 石景山天堂网
  • 政府网站 建设app大量微信群推广代发广告
  • 张家港专业的网站制作公司百度推广后台
  • 最牛黑客做的白粉交易网站百度官网认证多少钱一年
  • 手机网站重要性微信小程序怎么制作自己的程序
  • 小说网站采集可以做嘛成都网站优化排名
  • 先进的网站建设ui培训
  • 网页在线代理浏览优化关键词快速排名
  • 正定网站建设实训百度搜索引擎的总结
  • 使用arcgis进行网站开发seo优化靠谱吗
  • wordpress首页优化缩略图合肥品牌seo
  • 建设英文版网站百度推广账号注册
  • 佛山企业网站建设咨询wifi优化大师下载
  • 网站建设与管理知识点微博指数