- 浏览: 243374 次
最新评论
存储过程实例:
需求:
思路:建立存储过程
代码逻辑:
1、先清空缓存表t_cert_sample_tmp;
2、获取列表, 查询语句:
SELECT cert_id
FROM t_cert_state where is_export=1 and check_state=1 and ylf_export=0 group by cert_id;
3、循环计算单个cert_id的方法:
1)如果证书修改后状态为'W':取状态为G且未进入筛分系统的样本MD5
sqlsexec='select sample_md5 from t_cert_sample where cert_id=' || cert_id || ' and not exists (select sample_hash from t_sfa_sample where state=-1
and sample_hash=t_cert_sample.sample_md5) and exists (select sample_hash from t_white where sample_state=''G'' and sample_hash=t_cert_sample.sample_md5) limit 1';
2)如果证书修改后状态不是'W':
步骤1:优先查黑表,如果此证书下有黑样本,则取该证书下默认第一例黑样本MD5
sqlsexec='select sample_md5 from t_cert_sample t1,t_black t2 where t1.cert_id=' || cert_id || 'and t1.sample_md5=t2.sample_hash limit 1';
步骤2:如果黑表没有样本,则再查白表,取该证书下默认第一例样本MD5
sqlsexec='select sample_md5 from t_cert_sample t1,t_white t2 where t1.cert_id=' || cert_id || ' and t1.sample_md5=t2.sample_hash limit 1';
4、将证书id和刚刚获取到的样本MD5,插入到缓存表t_cert_sample_tmp(对应字段分别为cert_id和sample_md5)
建表:
CREATE TABLE t_cert_sample_tmp
(
id serial NOT NULL primary key,
cert_id integer NOT NULL,
sample_md5 character varying(41) NOT NULL
)
WITH (
OIDS=FALSE
);
ALTER TABLE t_cert_sample_tmp OWNER TO postgres;
GRANT ALL ON TABLE t_cert_sample_tmp TO postgres;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE t_cert_sample_tmp TO sqluser;
GRANT SELECT ON TABLE t_cert_sample_tmp TO fenxi;
grant SELECT, UPDATE ON sequence t_cert_sample_tmp_id_seq to sqluser;
--描述
COMMENT ON TABLE t_cert_sample_tmp IS '存放捕获判定分析已审核证书界面MD5实例数据';
COMMENT ON COLUMN t_cert_sample_tmp .cert_id IS '证书id';
COMMENT ON COLUMN t_cert_sample_tmp .sample_md5 IS '样本的md5值';
以下几种其实实现的是不同的结果,可以仔细研究下
实现:
-- Function: cert_sample_tmp()
-- DROP FUNCTION cert_sample_tmp();
CREATE OR REPLACE FUNCTION cert_sample_tmp()
RETURNS text AS
$BODY$
DECLARE
sqlsexec character varying :='';
sqlsexec1 character varying :='';
sqlsexec2 character varying :='';
sqlsexec3 character varying :='';
insexec character varying :='';
tmp_hash varchar(32);
r record;
r1 record;
r2 record;
r3 record;
BEGIN
------------------------------------------
----函数功能:优化捕获分析判定系统已审核证书界面md5取值逻辑,并提高页面加载性能
------------------------------------------
sqlsexec = 'truncate table t_cert_sample_tmp;';
execute sqlsexec;
----只取最新修改的一条记录
sqlsexec = 'select a.cert_id,a.later_state from
(select cert_id,later_state,record_time from t_cert_state where is_export=1 and check_state=1 and ylf_export=0 )a,
(select cert_id,max(record_time) as max_record_time from t_cert_state where is_export=1 and check_state=1 and ylf_export=0 group by cert_id)b
where a.record_time=b.max_record_time and a.cert_id=b.cert_id;';
for r in execute sqlsexec
loop
---如果证书修改后状态为'W':取状态为G且未进入筛分系统的样本MD5,将证书对应的hash取一条插入t_cert_sample_tmp表中
if r.later_state='W' then
sqlsexec1='select sample_md5,cert_id from t_cert_sample where cert_id='''|| r.cert_id ||''' and not exists (select sample_hash from t_sfa_sample where state=-1
and sample_hash=t_cert_sample.sample_md5) and exists (select sample_hash from t_white where sample_state=''G'' and sample_hash=t_cert_sample.sample_md5) limit 1';
raise notice '%',sqlsexec1;
execute sqlsexec1 into r1;
if r1.sample_md5 is not null then
tmp_hash = r1.sample_md5;
end if;
else
----如果证书修改后状态不是'W':1.优先查黑表,如果此证书下有黑样本,则取该证书下默认第一例黑样本MD5
sqlsexec2='select sample_md5 from t_cert_sample t1,t_black t2 where t1.cert_id='''|| r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec2;
execute sqlsexec2 into r2;
if r2.sample_md5 is not null then
tmp_hash = r2.sample_md5;
else
----2.如果黑表没有样本,则再查白表,取该证书下默认第一例样本MD5
sqlsexec3='select sample_md5 from t_cert_sample t1,t_white t2 where t1.cert_id='''||r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec3;
execute sqlsexec3 into r3;
if r3.sample_md5 is not null then
tmp_hash = r3.sample_md5;
end if;
end if;
end if;
insexec = 'insert into t_cert_sample_tmp(cert_id,sample_md5) values ('''||r.cert_id||''','''||tmp_hash||''');';
raise notice '%',insexec;
execute insexec;
end loop;
RETURN 'DONE';
exception when others then
RAISE EXCEPTION '(%)', SQLERRM;
return 'error';
END
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION cert_sample_tmp()
OWNER TO postgres;
GRANT EXECUTE ON FUNCTION cert_sample_tmp() TO public;
GRANT EXECUTE ON FUNCTION cert_sample_tmp() TO postgres;
GRANT EXECUTE ON FUNCTION cert_sample_tmp() TO sqluser;
======================================================================
DECLARE
sqlsexec character varying :='';
sqlsexec1 character varying :='';
sqlsexec2 character varying :='';
sqlsexec3 character varying :='';
insexec character varying :='';
tmp_hash varchar(32);
r record;
r1 record;
r2 record;
r3 record;
BEGIN
------------------------------------------
----函数功能:优化捕获分析判定系统已审核证书界面md5取值逻辑,并提高页面加载性能(每个证书下面只显示一个样本hash)
------------------------------------------
sqlsexec = 'truncate table t_cert_sample_tmp;';
execute sqlsexec;
sqlsexec = 'SELECT distinct cert_id FROM t_cert_state where is_export=1 and check_state=1 and ylf_export=0';
for r in execute sqlsexec
loop
sqlsexec1='select sample_md5,cert_id from t_cert_sample where cert_id='''|| r.cert_id ||''' and not exists (select sample_hash from t_sfa_sample where state=-1
and sample_hash=t_cert_sample.sample_md5) and exists (select sample_hash from t_white where sample_state=''G'' and sample_hash=t_cert_sample.sample_md5) limit 1';
raise notice '%',sqlsexec1;
execute sqlsexec1 into r1;
---如果证书修改后状态为'W':取状态为G且未进入筛分系统的样本MD5,将证书对应的所有hash都逐条插入t_cert_sample_tmp表中
if r1.sample_md5 is not null then
tmp_hash = r1.sample_md5;
else
----如果证书修改后状态不是'W':1.优先查黑表,如果此证书下有黑样本,则取该证书下默认第一例黑样本MD5
sqlsexec2='select sample_md5 from t_cert_sample t1,t_black t2 where t1.cert_id='''|| r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec2;
execute sqlsexec2 into r2;
if r2.sample_md5 is not null then
tmp_hash = r2.sample_md5;
else
----2.如果黑表没有样本,则再查白表,取该证书下默认第一例样本MD5
sqlsexec3='select sample_md5 from t_cert_sample t1,t_white t2 where t1.cert_id='''||r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec3;
execute sqlsexec3 into r3;
if r3.sample_md5 is not null then
tmp_hash = r3.sample_md5;
end if;
end if;
end if;
insexec = 'insert into t_cert_sample_tmp(cert_id,sample_md5) values ('''||r.cert_id||''','''||tmp_hash||''');';
raise notice '%',insexec;
execute insexec;
end loop;
RETURN 'DONE';
exception when others then
RAISE EXCEPTION '(%)', SQLERRM;
return 'error';
END
====================================================================================
DECLARE
sqlsexec character varying :='';
sqlsexec1 character varying :='';
sqlsexec2 character varying :='';
sqlsexec3 character varying :='';
insexec character varying :='';
tmp_hash varchar(32);
r record;
r1 record;
r2 record;
r3 record;
BEGIN
------------------------------------------
----函数功能:优化捕获分析判定系统已审核证书界面md5取值逻辑,并提高页面加载性能(每个证书下面满足条件的hash都显示出来)
------------------------------------------
sqlsexec = 'truncate table t_cert_sample_tmp;';
execute sqlsexec;
sqlsexec = 'SELECT distinct cert_id FROM t_cert_state where is_export=1 and check_state=1 and ylf_export=0';
for r in execute sqlsexec
loop
sqlsexec1='select sample_md5,cert_id from t_cert_sample where cert_id='''|| r.cert_id ||''' and not exists (select sample_hash from t_sfa_sample where state=-1
and sample_hash=t_cert_sample.sample_md5) and exists (select sample_hash from t_white where sample_state=''G'' and sample_hash=t_cert_sample.sample_md5)';
raise notice '%',sqlsexec1;
for r1 in execute sqlsexec1
loop
---如果证书修改后状态为'W':取状态为G且未进入筛分系统的样本MD5,将证书对应的所有hash都逐条插入t_cert_sample_tmp表中
if r1.sample_md5 is not null then
tmp_hash = r1.sample_md5;
insexec = 'insert into t_cert_sample_tmp(cert_id,sample_md5) values ('''||r1.cert_id||''','''||tmp_hash||''');';
raise notice '%',insexec;
execute insexec;
else
----如果证书修改后状态不是'W':1.优先查黑表,如果此证书下有黑样本,则取该证书下默认第一例黑样本MD5
sqlsexec2='select sample_md5 from t_cert_sample t1,t_black t2 where t1.cert_id='''|| r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec2;
execute sqlsexec2 into r2;
if r2.sample_md5 is not null then
tmp_hash = r2.sample_md5;
else
----2.如果黑表没有样本,则再查白表,取该证书下默认第一例样本MD5
sqlsexec3='select sample_md5 from t_cert_sample t1,t_white t2 where t1.cert_id='''||r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec3;
execute sqlsexec3 into r3;
if r3.sample_md5 is not null then
tmp_hash = r3.sample_md5;
end if;
end if;
insexec = 'insert into t_cert_sample_tmp(cert_id,sample_md5) values ('''||r.cert_id||''','''||tmp_hash||''');';
raise notice '%',insexec;
execute insexec;
end if;
end loop;
end loop;
RETURN 'DONE';
exception when others then
RAISE EXCEPTION '(%)', SQLERRM;
return 'error';
END
========================================
需求:
思路:建立存储过程
代码逻辑:
1、先清空缓存表t_cert_sample_tmp;
2、获取列表, 查询语句:
SELECT cert_id
FROM t_cert_state where is_export=1 and check_state=1 and ylf_export=0 group by cert_id;
3、循环计算单个cert_id的方法:
1)如果证书修改后状态为'W':取状态为G且未进入筛分系统的样本MD5
sqlsexec='select sample_md5 from t_cert_sample where cert_id=' || cert_id || ' and not exists (select sample_hash from t_sfa_sample where state=-1
and sample_hash=t_cert_sample.sample_md5) and exists (select sample_hash from t_white where sample_state=''G'' and sample_hash=t_cert_sample.sample_md5) limit 1';
2)如果证书修改后状态不是'W':
步骤1:优先查黑表,如果此证书下有黑样本,则取该证书下默认第一例黑样本MD5
sqlsexec='select sample_md5 from t_cert_sample t1,t_black t2 where t1.cert_id=' || cert_id || 'and t1.sample_md5=t2.sample_hash limit 1';
步骤2:如果黑表没有样本,则再查白表,取该证书下默认第一例样本MD5
sqlsexec='select sample_md5 from t_cert_sample t1,t_white t2 where t1.cert_id=' || cert_id || ' and t1.sample_md5=t2.sample_hash limit 1';
4、将证书id和刚刚获取到的样本MD5,插入到缓存表t_cert_sample_tmp(对应字段分别为cert_id和sample_md5)
建表:
CREATE TABLE t_cert_sample_tmp
(
id serial NOT NULL primary key,
cert_id integer NOT NULL,
sample_md5 character varying(41) NOT NULL
)
WITH (
OIDS=FALSE
);
ALTER TABLE t_cert_sample_tmp OWNER TO postgres;
GRANT ALL ON TABLE t_cert_sample_tmp TO postgres;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE t_cert_sample_tmp TO sqluser;
GRANT SELECT ON TABLE t_cert_sample_tmp TO fenxi;
grant SELECT, UPDATE ON sequence t_cert_sample_tmp_id_seq to sqluser;
--描述
COMMENT ON TABLE t_cert_sample_tmp IS '存放捕获判定分析已审核证书界面MD5实例数据';
COMMENT ON COLUMN t_cert_sample_tmp .cert_id IS '证书id';
COMMENT ON COLUMN t_cert_sample_tmp .sample_md5 IS '样本的md5值';
以下几种其实实现的是不同的结果,可以仔细研究下
实现:
-- Function: cert_sample_tmp()
-- DROP FUNCTION cert_sample_tmp();
CREATE OR REPLACE FUNCTION cert_sample_tmp()
RETURNS text AS
$BODY$
DECLARE
sqlsexec character varying :='';
sqlsexec1 character varying :='';
sqlsexec2 character varying :='';
sqlsexec3 character varying :='';
insexec character varying :='';
tmp_hash varchar(32);
r record;
r1 record;
r2 record;
r3 record;
BEGIN
------------------------------------------
----函数功能:优化捕获分析判定系统已审核证书界面md5取值逻辑,并提高页面加载性能
------------------------------------------
sqlsexec = 'truncate table t_cert_sample_tmp;';
execute sqlsexec;
----只取最新修改的一条记录
sqlsexec = 'select a.cert_id,a.later_state from
(select cert_id,later_state,record_time from t_cert_state where is_export=1 and check_state=1 and ylf_export=0 )a,
(select cert_id,max(record_time) as max_record_time from t_cert_state where is_export=1 and check_state=1 and ylf_export=0 group by cert_id)b
where a.record_time=b.max_record_time and a.cert_id=b.cert_id;';
for r in execute sqlsexec
loop
---如果证书修改后状态为'W':取状态为G且未进入筛分系统的样本MD5,将证书对应的hash取一条插入t_cert_sample_tmp表中
if r.later_state='W' then
sqlsexec1='select sample_md5,cert_id from t_cert_sample where cert_id='''|| r.cert_id ||''' and not exists (select sample_hash from t_sfa_sample where state=-1
and sample_hash=t_cert_sample.sample_md5) and exists (select sample_hash from t_white where sample_state=''G'' and sample_hash=t_cert_sample.sample_md5) limit 1';
raise notice '%',sqlsexec1;
execute sqlsexec1 into r1;
if r1.sample_md5 is not null then
tmp_hash = r1.sample_md5;
end if;
else
----如果证书修改后状态不是'W':1.优先查黑表,如果此证书下有黑样本,则取该证书下默认第一例黑样本MD5
sqlsexec2='select sample_md5 from t_cert_sample t1,t_black t2 where t1.cert_id='''|| r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec2;
execute sqlsexec2 into r2;
if r2.sample_md5 is not null then
tmp_hash = r2.sample_md5;
else
----2.如果黑表没有样本,则再查白表,取该证书下默认第一例样本MD5
sqlsexec3='select sample_md5 from t_cert_sample t1,t_white t2 where t1.cert_id='''||r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec3;
execute sqlsexec3 into r3;
if r3.sample_md5 is not null then
tmp_hash = r3.sample_md5;
end if;
end if;
end if;
insexec = 'insert into t_cert_sample_tmp(cert_id,sample_md5) values ('''||r.cert_id||''','''||tmp_hash||''');';
raise notice '%',insexec;
execute insexec;
end loop;
RETURN 'DONE';
exception when others then
RAISE EXCEPTION '(%)', SQLERRM;
return 'error';
END
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION cert_sample_tmp()
OWNER TO postgres;
GRANT EXECUTE ON FUNCTION cert_sample_tmp() TO public;
GRANT EXECUTE ON FUNCTION cert_sample_tmp() TO postgres;
GRANT EXECUTE ON FUNCTION cert_sample_tmp() TO sqluser;
======================================================================
DECLARE
sqlsexec character varying :='';
sqlsexec1 character varying :='';
sqlsexec2 character varying :='';
sqlsexec3 character varying :='';
insexec character varying :='';
tmp_hash varchar(32);
r record;
r1 record;
r2 record;
r3 record;
BEGIN
------------------------------------------
----函数功能:优化捕获分析判定系统已审核证书界面md5取值逻辑,并提高页面加载性能(每个证书下面只显示一个样本hash)
------------------------------------------
sqlsexec = 'truncate table t_cert_sample_tmp;';
execute sqlsexec;
sqlsexec = 'SELECT distinct cert_id FROM t_cert_state where is_export=1 and check_state=1 and ylf_export=0';
for r in execute sqlsexec
loop
sqlsexec1='select sample_md5,cert_id from t_cert_sample where cert_id='''|| r.cert_id ||''' and not exists (select sample_hash from t_sfa_sample where state=-1
and sample_hash=t_cert_sample.sample_md5) and exists (select sample_hash from t_white where sample_state=''G'' and sample_hash=t_cert_sample.sample_md5) limit 1';
raise notice '%',sqlsexec1;
execute sqlsexec1 into r1;
---如果证书修改后状态为'W':取状态为G且未进入筛分系统的样本MD5,将证书对应的所有hash都逐条插入t_cert_sample_tmp表中
if r1.sample_md5 is not null then
tmp_hash = r1.sample_md5;
else
----如果证书修改后状态不是'W':1.优先查黑表,如果此证书下有黑样本,则取该证书下默认第一例黑样本MD5
sqlsexec2='select sample_md5 from t_cert_sample t1,t_black t2 where t1.cert_id='''|| r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec2;
execute sqlsexec2 into r2;
if r2.sample_md5 is not null then
tmp_hash = r2.sample_md5;
else
----2.如果黑表没有样本,则再查白表,取该证书下默认第一例样本MD5
sqlsexec3='select sample_md5 from t_cert_sample t1,t_white t2 where t1.cert_id='''||r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec3;
execute sqlsexec3 into r3;
if r3.sample_md5 is not null then
tmp_hash = r3.sample_md5;
end if;
end if;
end if;
insexec = 'insert into t_cert_sample_tmp(cert_id,sample_md5) values ('''||r.cert_id||''','''||tmp_hash||''');';
raise notice '%',insexec;
execute insexec;
end loop;
RETURN 'DONE';
exception when others then
RAISE EXCEPTION '(%)', SQLERRM;
return 'error';
END
====================================================================================
DECLARE
sqlsexec character varying :='';
sqlsexec1 character varying :='';
sqlsexec2 character varying :='';
sqlsexec3 character varying :='';
insexec character varying :='';
tmp_hash varchar(32);
r record;
r1 record;
r2 record;
r3 record;
BEGIN
------------------------------------------
----函数功能:优化捕获分析判定系统已审核证书界面md5取值逻辑,并提高页面加载性能(每个证书下面满足条件的hash都显示出来)
------------------------------------------
sqlsexec = 'truncate table t_cert_sample_tmp;';
execute sqlsexec;
sqlsexec = 'SELECT distinct cert_id FROM t_cert_state where is_export=1 and check_state=1 and ylf_export=0';
for r in execute sqlsexec
loop
sqlsexec1='select sample_md5,cert_id from t_cert_sample where cert_id='''|| r.cert_id ||''' and not exists (select sample_hash from t_sfa_sample where state=-1
and sample_hash=t_cert_sample.sample_md5) and exists (select sample_hash from t_white where sample_state=''G'' and sample_hash=t_cert_sample.sample_md5)';
raise notice '%',sqlsexec1;
for r1 in execute sqlsexec1
loop
---如果证书修改后状态为'W':取状态为G且未进入筛分系统的样本MD5,将证书对应的所有hash都逐条插入t_cert_sample_tmp表中
if r1.sample_md5 is not null then
tmp_hash = r1.sample_md5;
insexec = 'insert into t_cert_sample_tmp(cert_id,sample_md5) values ('''||r1.cert_id||''','''||tmp_hash||''');';
raise notice '%',insexec;
execute insexec;
else
----如果证书修改后状态不是'W':1.优先查黑表,如果此证书下有黑样本,则取该证书下默认第一例黑样本MD5
sqlsexec2='select sample_md5 from t_cert_sample t1,t_black t2 where t1.cert_id='''|| r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec2;
execute sqlsexec2 into r2;
if r2.sample_md5 is not null then
tmp_hash = r2.sample_md5;
else
----2.如果黑表没有样本,则再查白表,取该证书下默认第一例样本MD5
sqlsexec3='select sample_md5 from t_cert_sample t1,t_white t2 where t1.cert_id='''||r.cert_id ||''' and t1.sample_md5=t2.sample_hash limit 1';
raise notice '%',sqlsexec3;
execute sqlsexec3 into r3;
if r3.sample_md5 is not null then
tmp_hash = r3.sample_md5;
end if;
end if;
insexec = 'insert into t_cert_sample_tmp(cert_id,sample_md5) values ('''||r.cert_id||''','''||tmp_hash||''');';
raise notice '%',insexec;
execute insexec;
end if;
end loop;
end loop;
RETURN 'DONE';
exception when others then
RAISE EXCEPTION '(%)', SQLERRM;
return 'error';
END
========================================
发表评论
-
pg 锁
2016-01-14 16:26 0pg 锁 ... -
postgresql 的三类日志
2016-01-14 15:59 18525一、PostgreSQL有3种日志: 1)pg_log(数据 ... -
pg存储过程--创建分区表
2016-01-13 15:46 01)将普通表改成按时间字段分区表 调用select fun_c ... -
pg常用自制shell脚本-tina
2016-01-13 15:30 49351)小型监控: 1.在pg库主机上部署,每5分钟执行一次,插入 ... -
postgresql 时间类型和相关函数
2016-01-13 10:41 5457今天来好好学习一下postgresql涉及时间的字段类型和一些 ... -
pg 表空间
2016-01-07 16:28 3123一、说明 在数据库运维工作中,经常会有数据目录使用率较高 ... -
pg 定期vacuum和reindex
2016-01-07 14:56 8613定期vacuum和reindex: 一 ... -
pg 序列
2016-01-06 16:58 1621一、简介 一个序列对象通常用于为行或者表生成唯一的标识符。 ... -
pg 简单备份和恢复
2016-01-06 15:53 3767pg的备份和恢复 pg_dump ... -
ERROR: invalid page header in block 27073 of relation base/21078/45300926
2016-01-06 15:12 2143突然断网,检查后通知我们UPS断电,db所在主机重启 1、连上 ... -
pg_cancel_backend()和pg_terminate_backend()
2016-01-05 17:42 3553pg_cancel_backend()和pg_terminat ... -
canceling statement due to conflict with recovery
2016-01-05 17:12 1679报错: canceling statement due to ... -
postgresql dblink 使用
2015-12-31 14:33 2041dblink的使用 pg的跨库查询工具 select dbli ... -
root用户不能使用psql或者pg_dump等pg命令
2015-12-24 14:40 7025root用户不能使用psql或者pg_dump等pg命令 [ ... -
postgresql新建库2个常见报错
2015-12-22 16:43 6257今天使用pg建库发现两个报错: ERROR: new c ... -
安装postgresql 9.1.1
2015-12-22 16:25 641安装postgresql 9.1.1 ---版本自选,步骤相同 ... -
pgbadger监控安装和使用
2015-12-21 10:01 2032pgbadger监控安装和使用 https://github ... -
oracle,postgresql,mysql一些使用上的区别记录
2015-12-16 11:38 01.限制行数: select * from ta where ... -
pg 函数sfa_tmp_sleep()执行越来越慢-sql分析
2015-12-11 09:48 678pg 函数sfa_tmp_sleep()执行越来越慢 ... -
pgpool 主从流复制模式下的安装使用
2015-12-11 09:50 4125pgpool-II 是一个位于 PostgreSQL 服务器和 ...
相关推荐
PostgreSQL中国社区资深数据库专家、沃趣科技首席数据库架构师撰写,PostgreSQL数据库领域经典著作 系统讲解PostgreSQL技术内幕,深入分析PostgreSQL特色功能,包含大量来自实际生产环境的经典案例和经验总结 ...
Postgresql存储过程详解 Postgresql存储过程是指在Postgresql数据库中定义的一组SQL语句的集合,它可以完成复杂的操作,并且可以重复使用。Postgresql存储过程可以用来实现业务逻辑,减少数据库服务器的压力和网络...
* 数据库管理系统:PostgreSQL是用于存储、管理和检索数据的系统。 * 数据库设计:PostgreSQL数据库设计包括数据模型、表结构、索引和约束等方面。 PostgreSQL安装与配置 * PostgreSQL安装:包括下载、安装和配置...
调试PostgreSQL存储过程首先需要一个支持调试功能的客户端工具,例如pgAdmin或psql。在pgAdmin中,你可以通过图形界面设置断点,查看变量值和调用堆栈。在命令行工具psql中,可以利用 `\set` 命令设置变量,以及`\...
PostgreSQL 存储过程详解 PostgreSQL 存储过程是一种强大的功能,可以实现复杂的逻辑操作和数据处理。下面将详细介绍 PostgreSQL 存储过程的结构、变量类型、连接字符、控制结构等知识点。 一、存储过程结构 存储...
PostgreSQL 存储过程详解 PostgreSQL 是一个开源的数据库管理系统,它提供了强大的数据存储和管理功能。其中,存储过程是一个非常重要的概念,本文将对 PostgreSQL 中的存储过程进行详细的介绍和解释。 什么是存储...
### PostGreSQL在Centos 7.9上的安装与部署 #### 一、引言 在开始学习任何数据库之前,最重要的第一步就是安装部署一个可供学习和测试的环境。选择一个在业界广泛使用的操作系统版本,以及一个成熟稳定的数据库...
**PostgreSQL实用实例参考** PostgreSQL,又称为PG,是一种开源的关系型数据库管理系统,以其强大的功能、稳定性以及高度的可扩展性而广受开发者欢迎。本文档深入浅出地介绍了PostgreSQL的诸多实用技巧和最佳实践,...
PostgreSQL存储过程是一种数据库编程的方法,它允许用户在数据库中定义和执行复杂的操作逻辑,而不仅仅是简单的查询。存储过程在数据库管理系统中起着至关重要的作用,它们可以提高性能,增加安全性,减少网络流量,...
PostgreSql修炼之道从小工到专家 ~高清PDF
postgresql临时表postgresql临时表postgresql临时表postgresql临时表
PostgreSQL 事务处理技术内幕深度探索 PostgreSQL 是一种开放源代码的关系数据库管理系统(RDBMS),它具有高度的可靠性、稳定性和安全性,被广泛应用于各种企业级应用和云服务。PostgreSQL 的事务处理机制是...
file_fdw 是一个外部表插件,用于将文件作为 PostgreSQL 的外部表。使用 file_fdw 可以将 CSV 文件、文本文件等作为 PostgreSQL 的外部表。 tds_fdw tds_fdw 是一个外部表插件,用于连接 Microsoft SQL Server ...
赠送jar包:postgresql-42.3.1.jar; 赠送原API文档:postgresql-42.3.1-javadoc.jar; 赠送源代码:postgresql-42.3.1-sources.jar; 赠送Maven依赖信息文件:postgresql-42.3.1.pom; 包含翻译后的API文档:...
- **文档内容**:包括PostgreSQL的基础介绍、性能优化技巧、安全连接配置、数据定义语言(DDL)、实体关系建模、视图管理、查询语言(DML)、存储过程与函数、规则系统、触发器、游标以及事务处理等方面的内容。...
目录是我(mantingfangabc)手动一条一条添加的.共享给所有需要的人. postgreSQL修炼之道从小工到专家-完整高清扫描版-完整目录
本套程序是在VS2005下C#开发,...在对PostgreSQL数据库进行操作时,用到了如何调用存储过程来完成各项操作。 将App_Data下的数据库文件导入到PostgreSQL 8.3版里面,库名为:HYGL 然后修改web.config中的配置即可使用
通过这个实例,我们可以学习到以下几点关于PostgreSQL存储过程的知识: 1. 存储过程的创建和替换:使用`CREATE OR REPLACE FUNCTION`语法。 2. 动态SQL的使用:允许在运行时构建SQL语句。 3. 安全地处理变量:使用`...
本文将深入探讨PostgreSQL中的CURD操作以及存储过程,并结合jdbc、hibernate、ibatis三种不同的Java数据访问技术进行讲解。 **一、CURD操作** 1. **创建(Create)**:在PostgreSQL中,创建表是最基本的操作。例如,...
POSTGRESQL修炼之道从小工到专家,高清扫描PDF版本。