"=?UTF-8?B?6LW15a6H6bmPKOWuh+W9rSk=?=" <zhaoyupeng....@alibaba-inc.com> writes: > I have discovered a peculiar issue: after creating a temporary view, if the > backend process exits abnormally, the temporary view is not cleaned up. > However, > if a temporary table is created and the backend process exits abnormally, the > temporary table is cleaned up.
I think this is intentional. A temp table may consume enough disk space that it's worth hacking up autovacuum to remove the space. The same cannot be said of other kinds of objects. (If we had temp materialized views, they might be worth cleaning up ... but we don't.) So we might as well leave the rest for the normal RemoveTempRelations call the next time somebody uses the temp namespace. Also, I don't buy the argument that it's better for autovacuum to be aggressive here. RemoveTempRelations will cope if, say, a temp view has a dependency on another one. autovacuum might fail entirely (blocking additional cleanup), if it happens to try to delete the wrong one first. So we should minimize the amount of stuff we expect autovacuum to accomplish. regards, tom lane