No space left on device
- 背景:当插入数据很大导致磁盘空间爆满时,PG会启动自杀,然后回滚因导致磁盘饱满的操作之后,并自动恢复数据库
create table t2 (tz time, device_id int , cpu_usage float);
insert into t2
SELECT time, device_id, random()*100 as cpu_usage
FROM generate_series(
'2021-01-01 00:00:00',
'2021-01-01 11:00:00',
INTERVAL '1 hour'
) as time,
generate_series(1,10000000) device_id;
-- 报错
SQL 错误 [53100]: ERROR: could not extend file "base/5/16428.4": No space left on device
Hint: Check free disk space.
-- log日志
2023-10-08 12:28:35.611 UTC [57831] ERROR: could not extend file "base/5/24620.3": No space left on device
2023-10-08 12:28:35.611 UTC [57831] HINT: Check free disk space.
2023-10-08 12:28:35.611 UTC [57831] STATEMENT:
insert into t2
SELECT time, device_id, random()*100 as cpu_usage
FROM generate_series(
'2021-01-01 00:00:00',
'2021-01-01 11:00:00',
INTERVAL '1 hour'
) as time,
generate_series(1,10000000) device_id
2023-10-08 12:28:35.721 UTC [57831] ERROR: relation "t2" does not exist at character 22