小编AMA*_*nc.的帖子

Why does vacuum full wait after it is "done"?

I am running a vacuum on a very large table.

When I run it, it says:

bacula=# VACUUM FULL VERBOSE file_partition_19
bacula-# ;
INFO:  vacuuming "public.file_partition_19"
INFO:  "file_partition_19": found 16242451 removable, 21024161 nonremovable row versions in 900380 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU 5.14s/14.42u sec elapsed 19.61 sec.
VACUUM
Time: 163784.767 ms
bacula=# 
Run Code Online (Sandbox Code Playgroud)

When it does this, it shows up to the CPU line fairly quickly, then waits a long time before it shows the …

postgresql vacuum postgresql-9.3

8
推荐指数
1
解决办法
908
查看次数

为什么 NamedTemporaryFile().write(没有中间变量)会导致“关闭文件的 I/O 操作”?

我有以下脚本,它以略有不同的方式两次执行相同的操作。第一个有效,第二个无效:

#!/usr/bin/python
import tempfile

fhandle=tempfile.NamedTemporaryFile(dir=".",delete=False)
fhandle.write("hello")

tempfile.NamedTemporaryFile(dir=".",delete=False).write("hello")
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Traceback (most recent call last):
  File "./test.py", line 7, in <module>
     tempfile.NamedTemporaryFile().write("hello")
 ValueError: I/O operation on closed file
Run Code Online (Sandbox Code Playgroud)

在我的示例脚本中,我将它们放在一起以表明第一个有效。这不影响结果,只是指出存在差异。

这是 Python 中的错误吗?我的机器有什么奇怪的吗?预期行为?正确的行为?看起来对象在 write() 之前被销毁。

Ubuntu 12.04.3 LTS 上的 Python 2.7.3

python temporary-files destroy

5
推荐指数
1
解决办法
967
查看次数