简体   繁体   English

PostgreSQL 临时表是否已经注销?

[英]Are PostgreSQL temporary tables already unlogged?

I am working on a database operation, which produces a lot of inserts (~ 15,000,000).我正在处理数据库操作,该操作会产生大量插入(~ 15,000,000)。

I am currently using a temporary table for this data, because the data is no longer required after the operation.我目前对这个数据使用了一个临时表,因为操作后不再需要这些数据。 I recently found out, that unlogged tables have a better insert performance and hence I want to use it.我最近发现,未记录的表具有更好的插入性能,因此我想使用它。 But reading the documentation , it is not clear to me if temporary tables are already unlogged?但是阅读文档,我不清楚临时表是否已经取消记录? And if they are not, is there a way to make them unlogged?如果不是,有没有办法让它们不被记录?

If I try to alter a temporary table like this:如果我尝试像这样更改临时表:

alter table temp_table set unlogged;

I get the error: [42P16] ERROR: cannot change logged status of table "test" because it is temporary我收到错误: [42P16] ERROR: cannot change logged status of table "test" because it is temporary

Temporary tables are never WAL logged.临时表永远不会被 WAL 记录。

Since they will be gone with the database session, there is never a need to recover them.由于它们将随数据库会话一起消失,因此永远不需要恢复它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM