problems with large table

From: Mike Charnoky <noky(at)nextbus(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: problems with large table
Date: 2007-09-12 15:42:20
Message-ID: 46E808DC.7030400@nextbus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm using PostgreSQL 8.1.8 and am having trouble with a table which
contains a large amount of data. Data is constantly being inserted into
the table, roughly a million inserts per hour at peak. The table
currently has about 100 million entries which take up 14G of space (24G
with indices).

The problem in nutshell: I noticed that certain queries were
excruciatingly slow, despite the use of an index. A vacuum analyze of
the table would not complete (despite running for 2 days). A reindex
also failed to complete after one day.

The details: I was trying to perform a count(*) based on a timestamp
field in the table (which is indexed). An EXPLAIN ANALYZE showed a high
cost even though an index scan was used. I tried to VACUUM ANALYZE the
table, thinking this might help. Yes, autovacuum is turned on, but
since pg8.1 does not store info about when a table was last vacuumed, I
decided to run this manually. After several hours, the vacuum did not
complete. So, I disabled the process which was writing to this table
and tried "set vacuum_cost_delay=0" before vacuuming. After two days,
the vacuum did not complete, so I stopped it and tried to reindex the
table, thinking that indices were corrupted. This also failed to
complete after one day.

At this point, I'm at a loss. I've searched the archives for similar
problems, but none of the suggestions have worked. Is the data in this
table corrupted? Why are both vacuum and reindex failing to complete?
Is there some sort of fine-tuning I should pay attention to? Any help
is much appreciated.

Mike

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-09-12 16:03:51 Re: update problem in partitioned tables
Previous Message Josh Harrison 2007-09-12 15:35:10 update problem in partitioned tables