惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - yahle

Performance Improvements in .NET 9 [翻译 by chatglm] Performance Improvements in .NET 8 & 7 & 6 -- File I/O【翻译】 Performance Improvements in .NET 8 & 7 & 6 -- String【翻译】 Performance Improvements in .NET 8 & 7 & 6 -- Thread【翻译】 Performance Improvements in .NET 8 -- Exceptions & Reflection & Primitives【翻译】 Performance Improvements in .NET 8 -- Native AOT & VM & GC & Mono【翻译】 Performance Improvements in .NET 8 -- JIT部分翻译 .net core 多线程下使用 Random 会出现bug 一个.net6开发的截图后ocr小工具 云服务器内容迁移 总结 立个铁矿石的flag,从7月初开始,铁矿石的库存,可能要进入累库存阶段了. 让你的 vs code 跑在云上,用手机浏览器就能写代码 - yahle ASP.NET Core 2 High Performance 目录和读书笔记 - yahle [转帖]无网络离线安装 vs2017 - yahle - 博客园 centos下 .net core 2.0 升级 到 2.1 遇到的一个小问题 .net core jwt 入门记录 - yahle GTX 750TI 使用 ffmpeg 时无法用 GPU HEVC(h.265) 进行加速 [翻译] 编写高性能 .NET 代码--第二章 GC -- 减少大对象堆的碎片,在某些情况下强制执行完整GC,按需压缩大对象堆,在GC前收到消息通知,使用弱引用缓存对象 - yahle [翻译] 编写高性能 .NET 代码--第二章 GC -- 将长生命周期对象和大对象池化
mysql迁移到pqsql笔记
yahle · 2023-07-03 · via 博客园 - yahle

在将MySQL迁移到PostgreSQL的过程中,遇到了一些问题,下面是一些简单的解决方案。

  • 使用命令,初始化数据库,并设置postgres的密码
    • bin\initdb -E UTF-8 -A md5 -U postgres -W -D data -- 如果只使用 bin\pg_ctl -D data init 则不会设置postgres的密码
    • 命令启动pqsql:bin\pg_ctl -D data -l postgresql.log start -- 启动后当前控制台不会退出,需要手动关闭(使用关闭脚本)
    • 关闭数据库:bin\pg_ctl -D data stop

为了允许本机以外的IP访问,需要修改监控模式。具体步骤如下:

  1. 修改 data\postgresql.conf 文件,将 listen_addresses 设置为 '*'
  2. 增加允许密码访问的地址,以允许特定账号使用密码登录。需要修改 data\pg_hba.conf 文件。在该文件中添加以下内容:
    host all all 192.168.1.0/24 md5
    其中,192.168.1.0/24 是允许访问的IP地址范围,md5 表示使用密码进行验证。

以下是使用 pqsql 时遇到的一些问题:

  1. 数据库名需要小写(虽然大写也能用),否则 HeidiSQL 工具无法使用。

  2. pqsql 自带 pgAdmin 4 工具,可以用来管理数据库

  3. ServiceStack 的 ORM,会自动把字段名和表名在执行时转为小写,所以在注册数据库连接时,对名字的处理策略,缓存默认的。
    ···
    var instance = PostgreSqlDialect.Instance;
    instance.NamingStrategy = new OrmLiteNamingStrategyBase();

    factory.RegisterConnection(databaseName, connStr, instance);
    ···

  4. ExecuteReader.Parse 会因为某些字段有特殊的序列化规则,而无法进行序列化
    解决办法,使用mysql分页脚本
    select * from {typeof(T).Name} limit batchSize offset skip -- 不好用,超过100w条记录后,会导致查询超时
    SELECT * FROM {typeof(T).Name} where id > {skip} and id <={skip + batchSize} -- 刚好默认id是自增的,可以使用这个脚本