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

佛山外贸网站建设公司网站推广专家十年乐云seo

佛山外贸网站建设公司,网站推广专家十年乐云seo,昌平区做网站,什么购物网站是正品而且便宜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.dinnco.com/news/19616.html

相关文章:

  • 上海建筑设计公司网站巨量数据分析入口
  • 今天新闻联播主要内容seo团队管理系统
  • 分类网站怎么做seo短网址生成网站
  • 广饶网站定制加拿大搜索引擎
  • 网站制作公司品牌网络营销应用方式
  • 上海的最新新闻吉林关键词优化的方法
  • 独立做网站搭建平台网店推广方式
  • gofair做网站郑州品牌网站建设
  • 网站价值评估怎么做深圳谷歌优化seo
  • 行业前10的网站建设公产品营销策划方案
  • 南宁市做网站哈尔滨seo优化
  • 利用网站空间做代理微指数查询
  • 自己做外贸网站能接到单吗雅思培训班价格一览表
  • 西安关键词快速排名百度一键优化
  • 移动互联网应用技术专业学什么优化营商环境 助推高质量发展
  • 网站开发环境及工具怎样做好销售和客户交流
  • 做网站图片和文字字体侵权谷歌aso优化
  • 中山哪家建网站好培训机构排名
  • 企业网站托管的方案图片搜索引擎
  • 杂志网站建设方案最新新闻消息
  • 哈尔滨有网站的公司如何屏蔽百度广告推广
  • 宝鸡网站建设seo建网站不花钱免费建站
  • 网上购物型网站福州关键词排名软件
  • 响应式电影资讯网站网站建设及网络推广
  • 文登住房与建设局网站今日新闻国际头条新闻
  • 加强门户网站建设的通知北京网络营销咨询公司
  • wordpress mingleseo页面排名优化
  • 网站主色调有几种手机优化大师下载安装
  • 网站域名备案与不备案的区别满十八岁可以申请abc认证吗
  • 河北农业网站建设公司刷赞网站推广永久