learning_notes

学习笔记

View project on GitHub

优化

坑和优化

  1. 历史数据的清理 ```sql –未优化语句 delete from line_queue where created_time < ‘2019-01-01’ and status = ‘deleted’; –优化语句,查找符合条件的5000条语句,每1秒执行一次,直到没有符合的语句 delete from line_queue where id in (select id from line_queue where created_time < ‘2019-01-01’ and status = ‘deleted’ limit 5000); \watch 1

```

  1. PostgreSQL 12支持ctid(物理行号)的nestloop join。使得表自关联的性能大幅度提升

  2. 使用pgfincore能够直接把磁盘内容刷到内存,又不占用pg的buffer