PostgreSQL:“;警告:共享内存不足“;关于简单选择
每当我尝试在我的Postgres db上进行简单选择时,我都会遇到以下错误:PostgreSQL:“;警告:共享内存不足“;关于简单选择,postgresql,postgis,timescaledb,Postgresql,Postgis,Timescaledb,每当我尝试在我的Postgres db上进行简单选择时,我都会遇到以下错误: 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: ou
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\u locks\u per\u 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插件,仅由一个表组成。
我可以执行所有其他语句(插入、更新等),但SELECT不起作用,而且非常烦人
它只涉及这个超表格。我只有表spatial\u ref\u sys在它旁边,我对这个没有问题
通过解释,我得到了完全相同的行为,没有任何信息记录:
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按照以下步骤设置此数据库:
以下是我用来设置数据库的说明:
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)