Re: postgresql meltdown on PlanetMath.org
От | Christopher Kings-Lynne |
---|---|
Тема | Re: postgresql meltdown on PlanetMath.org |
Дата | |
Msg-id | 088d01c2ecf8$3bf742e0$6500a8c0@fhp.internal обсуждение исходный текст |
Ответ на | postgresql meltdown on PlanetMath.org (Aaron Krowne <akrowne@vt.edu>) |
Список | pgsql-performance |
> I'm running this db on a celeron 450Mhz with 256MB RAM and a 60GB HDD > (7200 rpm). For the most part I have the db running "well enough." Over > time however, I find that performance degrades, the count(*) above is an > example of a command that does worse over time. It gets run once an hour > for stats collection. When I first migrated the db to v7.3.1 it would > take about 5-10 seconds (which it is close to now after a VACUUM FULL) but > after a few weeks it would take over a minute of really intense HDD > activity. Also of note is that when I first loaded the data it would > cache very well with the query taking maybe taking 15 seconds if I had > just started the db after reboot, but when it was in its "slow" state > repeating the query didn't noticably use the disk less (nor did it take > less time). To speed up your COUNT(*), how about doing this: Create a separate table to hold a single integer. Add a trigger after insert on your table to increment the counter in the other table Add a trigger after delete on your table to decrement the counter in the other table. That way you always have an O(1) count... Chris
В списке pgsql-performance по дате отправления: