1 http://bbs.pg
sqldb.com/client/post_show.
PHP?zt_auto_bh=46139、 比较下oracle 中, 它有参数share buffer,cache buffer,
一个sql语句过来,它会先再share buffer 中找是否有曾经执行过的同类语句,如果有,则为cache hit,这样的会速度就很快了,不用经过IO,如果没有,则为cache miss,则需要进解析,这时就需要有IO 的动作了,所以说oracle之所以很快是再这两个参数方面很充分的利用了内存,得以速度加快。 所以由此想到postgre
sql 中shared_buffer 和effective_cache_size,这两个参数,不知是否类似?它的工作原理是什么,即进来
一个DML语句,它的执行流程是什么?请高手讲下,在网上好像没有关于postgre
sql 的这方面资料。 还有一点我发现postgre
sql 中,如果你设了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 p
arameter you should consider both Postgre
sql's shared buffers and the portion of the kernel's
disk cache that will be used for Postgre
sql data files. Also,take into account the expected number of concurrent queries on different tables,since t
hey will have to share the available space. This p
arameter has no effect on the size of shared memory allocated by Postgre
sql,
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 deter
mined 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 p
arameter can only be set at server start. Increasing this p
arameter might cause Postgre
sql to request more Sy
stem V shared memory than your ope
rating sy
stem's default con
figuration allows. See Section 17.4.1,“Shared Memory and Semaphores” for @R_454_
4045@ion on how to adjust those p
arameters,if necessary. 2
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。