| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Matt Gordon" <m(dot)gordon(at)f5(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: VACUUM ANALYZE -vs- ANALYZE on an insert-only table. |
| Date: | 2003-12-15 23:01:41 |
| Message-ID: | 16722.1071529301@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
"Matt Gordon" <m(dot)gordon(at)f5(dot)com> writes:
> If I have a table that I only use for INSERTs and queries (no UPDATEs
> or DELETEs), is it enough to just run ANALYZE on the table instead of
> VACUUM ANALYZE? In other words, is running a VACUUM on a table useful
> if all that you're doing is INSERTing into it?
It's of marginal value: it ensures that the commit status bits of the
table's rows are up-to-date, which can save work for subsequent SELECTs.
You *must* vacuum every table in your database at least once every
billion transactions to avoid transaction wraparound problems; and in
practice you probably want to do it more frequently than that to avoid
unreasonable growth of the pg_clog/ files. But most people don't need
daily VACUUMs to meet that goal...
One caveat: do any of your inserting transactions ever fail? If so, you
need VACUUM to clean up any dead tuples they may have inserted before
failing.
> If it matters, we're currently using Postgres 7.2.1.
You should get yourself to 7.2.4 posthaste, if not 7.3.5 or 7.4. There
were some really nasty bugs fixed between 7.2.1 and 7.2.4.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2003-12-15 23:08:15 | Re: Relational data model dead? |
| Previous Message | Jenny Zhang | 2003-12-15 22:43:44 | Re: deadlock detected when inserting data |