使用Postgresql基因查询优化

使用Postgresql基因查询优化,第1张

概述最近看到了一个关于Postgresql的基因查询优化方式,刚开始还不知道怎么用,后来才发现很简单,主要也是在配置文件postgresql.conf里进行配置, 关于基因查询优化的作用,简单地说就是处理关系查询的,也就是连接。 相关参数如图(基于8.4版本): 参数说明(基于9.1版本): geqo ( boolean) Enables or disables genetic query optim

最近看到了一个关于Postgresql的基因查询优化方式,刚开始还不知道怎么用,后来才发现很简单,主要也是在配置文件postgresql.conf里进行配置,
关于基因查询优化的作用,简单地说就是处理关系查询的,也就是连接。
相关参数如图(基于8.4版本):


参数说明(基于9.1版本):

geqo ( boolean) @H_403_16@

Enables or disables genetic query optimization. This is on by default. It is usually best not to turn it off in production; thegeqo_threshold variable provIDes more granular control of GEQO.

geqo_threshold ( integer) @H_403_16@

Use genetic query optimization to plan querIEs with at least this many FROM items involved. (Note that a FulL OUTER JOIN construct counts as only oneFROM item.) The default is 12. For simpler querIEs it is usually best to use the deterministic,exhaustive planner,but for querIEs with many tables the deterministic planner takes too long,often longer than the penalty of executing a suboptimal plan.

geqo_effort ( integer) @H_403_16@

Controls the Trade-off between planning time and query plan quality in GEQO. This variable must be an integer in the range from 1 to 10. The default value is five. Larger values increase the time spent doing query planning,but also increase the likelihood that an efficIEnt query plan will be chosen.

geqo_effort doesn't actually do anything directly; it is only used to compute the default values for the other variables that influence GEQO behavior (described below). If you prefer,you can set the other parameters by hand instead.

geqo_pool_size ( integer) @H_403_16@

Controls the pool size used by GEQO,that is the number of indivIDuals in the genetic population. It must be at least two,and useful values are typically 100 to 1000. If it is set to zero (the default setting) then a suitable value is chosen based ongeqo_effort and the number of tables in the query.

geqo_generations ( integer) @H_403_16@

Controls the number of generations used by GEQO,that is the number of iterations of the algorithm. It must be at least one,and useful values are in the same range as the pool size. If it is set to zero (the default setting) then a suitable value is chosen based on geqo_pool_size.

geqo_selection_bias ( floating point) @H_403_16@

Controls the selection bias used by GEQO. The selection bias is the selective pressure within the population. Values can be from 1.50 to 2.00; the latter is the default.

geqo_seed ( floating point) @H_403_16@

Controls the initial value of the random number generator used by GEQO to select random paths through the join order search space. The value can range from zero (the default) to one. varying the value changes the set of join paths explored,and may result in a better or worse best path being found.

总结

以上是内存溢出为你收集整理的使用Postgresql基因查询优化全部内容,希望文章能够帮你解决使用Postgresql基因查询优化所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1179467.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存