X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5618DD1B1CE for ; Mon, 10 May 2004 16:17:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 18268-03 for ; Mon, 10 May 2004 16:17:28 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 561DCD1B196 for ; Mon, 10 May 2004 16:17:26 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4AJHPSx045023 for ; Mon, 10 May 2004 19:17:25 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4AJA9eB039439 for pgsql-performance@postgresql.org; Mon, 10 May 2004 19:10:10 GMT From: Chris Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Why queries takes too much time to execute? Date: Mon, 10 May 2004 14:11:21 -0400 Organization: cbbrowne Computing Inc Lines: 43 Message-ID: <60llk05f06.fsf@dev6.int.libertyrms.info> References: <00b901c43697$333ec5d0$5f00a8c0@suport01> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.110002 (No Gnus v0.2) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:yhcih0Taht1Fj6m7FEZOe9EMeP0= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/62 X-Sequence-Number: 6893 teouique@terra.com.br ("Anderson Boechat Lopes") writes: >     I´m new here and i´m not sure if this is the right email to > solve my problem. This should be OK... >     Well, i have a very large database, with vary tables and very > registers. Every day, too many operations are perfomed in that DB, > with queries that insert, delete and update. Once a week some > statistics are collected using vacuum analyze. > >     The problem is after a period of time (one month, i think), the > queries takes too much time to perform. A simple update can take 10 > seconds or more to perform. It seems fairly likely that two effects are coming in... -> The tables that are being updated have lots of dead tuples. -> The vacuums aren't doing much good because the number of dead tuples is so large that you blow out the FSM (Free Space Map), and thus they can't free up space. -> Another possibility is that if some tables shrink to small size, and build up to large size (we see this with the _rserv_log_1_ and _rserv_log_2_ tables used by the eRServ replication system), the statistics may need to be updated a LOT more often. You might want to consider running VACUUM a whole lot more often than once a week. If there is any regular time that the system isn't terribly busy, you might want to vacuum some or all tables at that time. pg_autovacuum might be helpful; it will automatically do vacuums on tables when they have been updated heavily. There may be more to your problem, but VACUUMing more would allow us to get rid of "too many dead tuples around" as a cause. -- "cbbrowne","@","acm.org" http://cbbrowne.com/info/x.html Would-be National Mottos: USA: "There oughta' be a law!"