最近看到了一个关于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; the geqo_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 one FROM 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 on geqo_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.
分享到:
相关推荐
PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS)支持大部分的SQL标准并且提供了很多其他现代特性,如复杂查询、外键、触发器、视图、事务完整性、多版本并发控制等。现在用户越来越多...
postgresql 优化配置,各种内存、连接数、缓存、并发、日志等策略配置。
PostgreSQL 最佳性能优化实践授课PPT 386页,适合对PostgreSQL了解的朋友,当然你熟悉mysql或oracle也有参考价值!
PostgreSQL 最佳性能优化实践授课PPT 386页,适合对PostgreSQL了解的朋友,当然你熟悉mysql或oracle也有参考价值!
上亿数据的select怎么整?不仅仅是分页的问题。请看附件方案
研究了PostgreSQL查询引擎中等价类在查询优化过程中的应用原理,详细阐述了其如何帮助优化器产生潜在的等值连接,等式约束和记录排序信息。同时也发现PostgreSQL查询引擎并没有充分利用等价类的属性约简特性,以及...
自适应查询优化自适应查询优化是标准PostgreSQL基于成本的查询优化器的扩展。 它的基本原理是使用查询执行统计信息来改善基数估计。 实验自适应查询优化自适应查询优化是标准PostgreSQL基于成本的查询优化器的扩展。...
aqo:PostgreSQL自适应查询优化
我们在实际应用中,常常会碰到这样的场景:分组取top值,比如取某一部门收入前10的人。 一般我们都会用到窗口函数去解决这类问题,同样在pg中也支持窗口函数。 例子: 创建测试表,生成10000个分组,1000万条记录。...
介绍了建立了一个包含INSERT, UPDATE, SELECT数据库请求的简单的业务模型, 并使用pgbench模拟业务请求, 详细的阐述PostgreSQL数据库的调优全过程。
PostgreSQL 性能优化培训 3 DAY
德哥的Postgresql数据库优化的培训视频,从Postgtesql的安装,配置,到数据库配置文件postgresql.conf的讲解,执行计划的查看,非常详细。
PostgreSQL MySQL Oracle数据库设计优化完美攻略
使用场景: 1. 要求LIKE '%xxx%'模糊查询支持索引,提高数据检索速度 2. 在上一场景的基础上,实现了对多个OR条件语句的索引查询支持
postgresql数据删除优化(清理磁盘空间碎片VACUUM);postgresql表数据很少,但查询插入速度非常慢,问题解决
postgresql 正则代替in查询 当需要参数查询时非常有用
PG源码解析系列之查询引擎源码技术探析,postgresql基础,postgresql源码,postgresql查询优化,postgresql查询引擎,postgresql源码解析
树PostgreSQL的递归查询树PostgreSQL的递归查询树PostgreSQL的递归查询
postgresql 官方中文杂志 怎么最大化postgresql性能 第0期,优化postgresql性能 第1期 postgresql 9.1 发布