2

我正在尝试将 Windows 7 机器中 postgresql.conf 文件中的 shared_buffer 从 1GB 增加到 2 GB,因为我有 8 GB 的 RAM,但是当我进行更改并尝试启动 postgres 服务时,它没有启动,当我查看时即使是查看器,它也会给我以下错误。

 2013-03-18 16:07:41 ISTFATAL:  could not create shared memory segment: 8
 2013-03-18 16:07:41 ISTDETAIL:  Failed system call was MapViewOfFileEx.

请帮帮我

4

1 回答 1

4

You're almost certainly running a 32-bit PostgreSQL if you're using 8.4, so the shared memory size is limited by the process's 2GB of total available address space. 32-bit Windows (including 32-bit processes running on 64-bit Windows via Wow64) uses a 2GB/2GB user/kernel split.

The error message means that Pg is trying to allocate more shared memory than the system can map so the system call is failing. You can't really fix this, but you don't need to.

Even 1GB shared_buffers is probably too much for 32-bit Pg on Windows and benchmarks have tended to back that up. You're almost certainly better off keeping shared_buffers fairly low and increasing effective_cache_size to tell the planner how much disk cache the OS has available to it. You should probably plan an upgrade to PostgreSQL 9.2 for general performance improvements and a longer maintenance lifetime per the version policy.

Consider posting another question to dba.stackexchange.com with details on WHY you want to increase it. What problem are you trying to solve? If it's a slow query read the postgresql tag info and postgresql-performance tag info. If you do post a new question, please add a link to it here so people can follow.

于 2013-03-18T10:49:10.457 回答