4

每当我尝试在我的 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

我的数据库实现了TimescaleDBPostGIS插件,并且仅由一张表组成。我可以执行所有其他语句(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

这是我用来设置数据库的说明:

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)
4

0 回答 0