我有一个 PostgreSQL 表。select *很慢,但又select id好又快。我认为可能是行的大小非常大并且需要一段时间来运输,或者可能是其他一些因素。
我需要所有字段(或几乎所有字段),因此仅选择一个子集不是一个快速解决方案。选择我想要的字段仍然很慢。
这是我的表架构减去名称:
integer | not null default nextval('core_page_id_seq'::regclass)
character varying(255) | not null
character varying(64) | not null
text | default '{}'::text
character varying(255) |
integer | not null default 0
text | default '{}'::text
text |
timestamp with time zone |
integer |
timestamp with time zone |
integer |
Run Code Online (Sandbox Code Playgroud)
文本字段的大小可以是任意大小。但是,在最坏的情况下,不会超过几千字节。
postgresql performance size disk-space postgresql-performance
我在 Ubuntu 上使用 PostgreSQL 9.1。VACUUM ANALYZE仍然推荐预定,还是 autovacuum 足以满足所有需求?
如果答案是“视情况而定”,那么:
我问是因为预定的时间VACUUM ANALYZE会影响我的报告。它运行了 5 个多小时,本周我不得不杀死它两次,因为它影响了常规的数据库导入。check_postgres不会报告数据库有任何显着膨胀,所以这不是真正的问题。
从文档中,autovacuum 也应该处理事务 ID 环绕。问题是:我还需要一个VACUUM ANALYZE吗?