错误:无法扩展文件“ pg

编程入门 行业动态 更新时间:2024-10-25 06:24:29
本文介绍了错误:无法扩展文件“ pg_tblspc / 4815857 / PG_11_201809051 / 16321”:设备上没有剩余空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的 postgres表占用了100%的内存,并想截断它。

当我使用 TRUNCATE TABLE TABLE_NAME 语句在下面给出错误:

When I USE TRUNCATE TABLE TABLE_NAME statement it gives be below Error:

错误:无法扩展文件 pg_tblspc / 4815857 / PG_11_201809051 / 16321:设备上没有剩余空间提示:检查可用磁盘空间。

ERROR: could not extend file "pg_tblspc/4815857/PG_11_201809051/16321": No space left on device HINT: Check free disk space.

因此,我尝试了 DELETE FROM TABLE_NAME 语句,该语句不会释放已使用的空间。

So I tried DELETE FROM TABLE_NAME statement which doesn't free the used space.

如何强制执行

推荐答案

TRUNCATE 需要创建一个新的(空)文件吗?表,这可能会导致您的问题。您可以 DROP 表并重新创建它。

TRUNCATE needs to create a new (empty) file for the table, which probably causes your problem. You can DROP the table and recreate it.

另一种更麻烦的方法是

DELETE FROM table_name; VACUUM table_name; -- no FULL!

虽然 VACUUM 通常不会缩小表,它将截断表末尾的emply页。如果该表为空,则将删除所有页面。

While VACUUM normally does not shrink the table, it will truncate emply pages off the end of the table. If the table is empty, that would remove all pages.

更多推荐

错误:无法扩展文件“ pg

本文发布于:2023-10-18 12:47:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504271.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   文件   pg

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!