最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

Postgres技巧

来源:动视网 责编:小采 时间:2020-11-09 14:34:09
文档

Postgres技巧

Postgres技巧:在业务量大的时候 碰到需要添加索引,需要用到 CONCURRENTLY,不然你的库很容易会坏的 如 create index CONCURRENTLY idx_order_records_bank_statist_uid on order_records(statist_uid) 见 http://www.postgresq
推荐度:
导读Postgres技巧:在业务量大的时候 碰到需要添加索引,需要用到 CONCURRENTLY,不然你的库很容易会坏的 如 create index CONCURRENTLY idx_order_records_bank_statist_uid on order_records(statist_uid) 见 http://www.postgresq


在业务量大的时候 碰到需要添加索引,需要用到 CONCURRENTLY,不然你的库很容易会坏的 如 create index CONCURRENTLY idx_order_records_bank_statist_uid on order_records(statist_uid) 见 http://www.postgresql.org/docs/9.1/static/sql-createindex.htm

在业务量大的时候 碰到需要添加索引,需要用到 CONCURRENTLY,不然你的库很容易会坏的

create index CONCURRENTLY idx_order_records_bank_statist_uid on order_records(statist_uid)

http://www.postgresql.org/docs/9.1/static/sql-createindex.html

在大的业务量下,如果你要去执行一些费时耗数据库的任务 有时会发现 某一个任务 还在暗地里执行着 需要我们 手动的 关闭 该任务

如果你是 kill 对应的pid ,那么你玩了,你很有可能会出现 数据库的问题

保险的做法是 用 PG_CANCEL_BACKEND

通过 如下查找对应的PID

select pid, trim(starttime) as start, 
duration, trim(user_name) as user,
substring (query,1,40) as querytxt
from stv_recents
where status = 'Running';

查看

select pg_cancel_backend(802);

通过如下 杀掉 任务

pg_cancel_backend( pid )

http://docs.aws.amazon.com/redshift/latest/dg/PG_CANCEL_BACKEND.html

文档

Postgres技巧

Postgres技巧:在业务量大的时候 碰到需要添加索引,需要用到 CONCURRENTLY,不然你的库很容易会坏的 如 create index CONCURRENTLY idx_order_records_bank_statist_uid on order_records(statist_uid) 见 http://www.postgresq
推荐度:
标签: 添加 小技巧 技巧
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top