每当我尝试在Postgres数据库上进行简单的SELECT时,我都会收到此错误:
tutorial=> select id from table LIMIT 1;
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
WARNING: out of shared memory
ERROR: out of shared memory
HINT: You might need to increase max_locks_per_transaction.
我尝试将“ max_locks_per_transaction ”增加到256,增加所有内存参数,它什么都不做。该命令只需要更长时间才能返回。
所有这些都在几个月内正常工作,然后出现此问题,我无法追踪日志以查找会发生什么。
出现此问题后,我尝试重新启动postgres后出现问题时的启动顺序:
LOG: database system was not properly shut down; automatic recovery in progress
LOG: redo starts at 2/2C7A1580
LOG: invalid record length at 2/2C848AC8: wanted 24, got 0
LOG: redo done at 2/2C848AA0
LOG: last completed transaction was at log time 2018-01-29 14:38:52.726603+00
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
我的数据库实现 TimescaleDB 和 PostGIS 插件,仅由一个表组成。 我可以做所有其他语句(INSERT,UPDATE等),但SELECT不起作用,这很烦人。
只关注这种过分的问题。我旁边只有 spatial_ref_sys 表格,我对此没有任何问题。
使用EXPLAIN,我得到完全相同的行为,没有信息记录:
tutorial=> EXPLAIN SELECT id FROM table LIMIT 1;
WARNING: out of shared memory
ERROR: out of shared memory
HINT: You might need to increase max_locks_per_transaction.
服务器是Debian 2x86 64位内核和 2GB内存。 我按照以下步骤使用 docker 设置了此数据库:http://docs.timescale.com/v0.8/getting-started/installation/linux/installation-docker
以下是我用来设置db的指令:
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE TABLE "public"."table" (
"id" BIGSERIAL NOT NULL PRIMARY KEY,
"id_s" int8 NOT NULL,
"id_g" int8,
"datetime" TIMESTAMPTZ DEFAULT now(),
[...]
);
SELECT create_hypertable('table', 'datetime');
ALTER TABLE table ADD CONSTRAINT id_pkey PRIMARY KEY (id, datetime);
CREATE INDEX ON table (id_s, datetime DESC);
CREATE INDEX ON table (id_g, datetime DESC);
ALTER TABLE table ADD COLUMN geom geometry(POINT,2192)