使用Postgresql基因查询优化

前端之家收集整理的这篇文章主要介绍了使用Postgresql基因查询优化前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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


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

geqo ( boolean)

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)

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)

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)

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)

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)

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)

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.

原文链接:https://www.f2er.com/postgresql/196795.html

猜你在找的Postgre SQL相关文章