众所周知,缓存是提高数据库性能的一个重要手段.本文着重讲一讲PostgreSQL中的缓存相关的东西.当然万变不离其宗,原理都是共同的,理解了这些,你也很容易把它运用到其它数据库中. What is a cache and why do we need one 不同的计算机组件运行的速度是不一样的,他们的差距很大,一般都是数量级级别的差距.比如速度上磁盘<RAM<system cache(如下图).在数据量小的时候你可能觉察不出差异,但是尤其在现在这个大数据的时代,你很轻易就能感知他们的差异,比
postgres创建索引参考 http://www.cnblogs.com/stephen-liu74/archive/2012/05/09/2298182.html CREATE TABLE test1 ( id integer, content varchar ); CREATE INDEX test1_id_index ON test1 (id); 创建存储过程 CREATE OR REPLACE FUNCTION update_sqs(lng "v
在程序中遇到这样的需求, 数据库表格式如下 需要把批量更新status, 如name = fox 时, status = 1, name = boa 时,status = 2 .... 类似的 postgres 的写法如下: update 表名 set status = case name when 'dodo' then '1' when 'eel' then '1' end where name in('dodo', 'eel');