postgresl问题探讨1

前端之家收集整理的这篇文章主要介绍了postgresl问题探讨1前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1 http://bbs.pgsqldb.com/client/post_show.PHP?zt_auto_bh=46139、 比较下oracle 中, 它有参数share buffer,cache buffer,一个sql语句过来,它会先再share buffer 中找是否有曾经执行过的同类语句,如果有,则为cache hit,这样的会速度就很快了,不用经过IO,如果没有,则为cache miss,则需要进解析,这时就需要有IO 的动作了,所以说oracle之所以很快是再这两个参数方面很充分的利用了内存,得以速度加快。 所以由此想到postgresql 中shared_buffer 和effective_cache_size,这两个参数,不知是否类似?它的工作原理是什么,即进来一个DML语句,它的执行流程是什么?请高手讲下,在网上好像没有关于postgresql 的这方面资料。 还有一点我发现postgresql 中,如果你设了shared_buffers=400M,effective_cache_size=400M,硬体总共有1G,当DB启动后,系统显示并没有占用800M的内存,但是当有sql运行时,这时系统的内存使用会增加。但oracle 中,一但分配了多少内存,当DB启动后不管有没有用户再用,它都会先显示oracle 这个进程已经用了800M 复:探讨--postgres 工作原理即流程-- 发表于 2008-11-14 04:57:21 3楼 effective_cache_size 只是给优化器计算代价使用,不会占用内存空间 shared_buffers (integer) 存放数据块的cache,相当于oracle的 cache buffer,使用的是共享内存方式,在windows下可能看不大出来 在unix下面用ipcs -ma能看到分配了多少共享内存 sql语句在pg里面不会自动保存在shared pool中,每次都会 parser-》analyze-》optimizer-》execute 类似于oracle每次hard parser 要减少parser这些开销,使用prepare 再execute方式 effective_cache_size (integer) Sets the planner's assumption about the effective size of the disk cache that is available to a single query. This is factored into estimates of the cost of using an index; a higher value makes it more likely index scans will be used,a lower value makes it more likely sequential scans will be used. When setting this parameter you should consider both Postgresql's shared buffers and the portion of the kernel's disk cache that will be used for Postgresql data files. Also,take into account the expected number of concurrent queries on different tables,since they will have to share the available space. This parameter has no effect on the size of shared memory allocated by Postgresql,nor does it reserve kernel disk cache; it is used only for estimation purposes. The default is 128 megabytes (128MB). shared_buffers (integer) Sets the amount of memory the database server uses for shared memory buffers. The default is typically 32 megabytes (32MB),but might be less if your kernel settings will not support it (as determined during initdb). This setting must be at least 128 kilobytes and at least 16 kilobytes times max_connections. (Non-default values of BLCKSZ change the minimum.) However,settings significantly higher than the minimum are usually needed for good performance. Several tens of megabytes are recommended for production installations. This parameter can only be set at server start. Increasing this parameter might cause Postgresql to request more System V shared memory than your operating system's default configuration allows. See Section 17.4.1,“Shared Memory and Semaphores” for information on how to adjust those parameters,if necessary. 2 原文链接:https://www.f2er.com/postgresql/196131.html

猜你在找的Postgre SQL相关文章