PostgreSQL pg_current_xlog_insert_location()与pg_current_xlog_location()
来源:互联网 发布:jquery ui.js cdn 编辑:程序博客网 时间:2024/06/14 05:21
PostgreSQL pg_current_xlog_insert_location()与pg_current_xlog_location() pg_current_xlog_insert_location指写入wal buffer的位置.pg_current_xlog_location返回已经write到wal文件的位置.我们来做个实验验证一下。查看目前两个函数结果是否相同。highgo=# select pg_current_xlog_insert_location(),pg_current_xlog_location(); pg_current_xlog_insert_location | pg_current_xlog_location ---------------------------------+-------------------------- 0/B9000098 | 0/B9000098(1 row)使用异步提交可以看到这个差异。synchronous_commit = off #关闭同步提交wal_writer_delay = 10000ms #开启延迟10000ms (1-10000 milliseconds)在一个窗口批量插入数据,打开另外的窗口查看。highgo=# insert into tbl_kenyon select generate_series(1,1000000),'kenyon good',md5('kenyon good boy');INSERT 0 1000000highgo=# select pg_current_xlog_insert_location(),pg_current_xlog_location(); pg_current_xlog_insert_location | pg_current_xlog_location ---------------------------------+-------------------------- 0/C0379BE0 | 0/BF37A000(1 row)通过以下函数,查看具体的xlog文件,可以发现两者对应的xlog文件不同。highgo=# select pg_xlogfile_name_offset('0/C0379BE0'),pg_xlogfile_name_offset('0/BF37A000'); pg_xlogfile_name_offset | pg_xlogfile_name_offset ------------------------------------+------------------------------------ (0000000B00000000000000C0,3644384) | (0000000B00000000000000BF,3645440)(1 row)等待一段时间后,会发现两者再次相同。highgo=# select pg_current_xlog_insert_location(),pg_current_xlog_location(); pg_current_xlog_insert_location | pg_current_xlog_location ---------------------------------+-------------------------- 0/C0379BE0 | 0/C0379BE0(1 row)highgo=# select pg_xlogfile_name_offset('0/C0379BE0'); pg_xlogfile_name_offset ------------------------------------ (0000000B00000000000000C0,3644384)(1 row)如上所示,也就是说pg_current_xlog_insert_location()是领先于pg_current_xlog_location()的。这也正好符合预期。因为数据变化会先写入wal buffer,然后再写入wal文件。参考德哥博客:http://blog.163.com/digoal@126/blog/static/1638770402014395222222/
阅读全文
0 0
- PostgreSQL pg_current_xlog_insert_location()与pg_current_xlog_location()
- PostgreSQL pg_current_xlog_insert_location()与pg_current_xlog_location()
- postgresql 与 java
- PostgreSQL 备份与恢复
- PostgreSQL与MySQL比较
- PostgreSQL与MySQL比较
- PostgreSQL与MySQL比较
- PostgreSQL与MySQL比较
- PostgreSQL与MySQL对比
- 编译postgresql与pgagent
- postgresql 维护与优化
- postgresql与mysql
- PostgreSQL与MySQL比较
- PostgreSQL与MySQL比较
- PostgreSQL 备份与恢复
- PostgreSQL与MySQL比较
- PostgreSQL与MySQL比较
- PostgreSQL与MySQL比较
- 配置 VIM 英语字典
- Python学习笔记(8)- if语句
- 更改mysql 用户的IP访问限制
- opencv python 3 数值操作
- 15.1 ByteArrayInputStream(字节数组输入流)和ByteArrayOutputStream类(字节数组输出流)
- PostgreSQL pg_current_xlog_insert_location()与pg_current_xlog_location()
- PostgreSQL 角色与用户管理介绍
- 解析 virDomainDef 结构体
- 炫酷的空气净化器控件
- Java面试题——关于String创建几个对象问题
- C++笔试题(剑指offer 面试题5 将单向链表数据,逆向打印输出)
- 记录一下 Spring 如何扫描注解的 Bean 与资源
- IDEA Mybatis Plugin 3.21
- ImportError: No module named 'yaml'