X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E688BD7BC4 for ; Tue, 30 Aug 2005 15:37:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32771-07 for ; Tue, 30 Aug 2005 18:37:32 +0000 (GMT) Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) by svr1.postgresql.org (Postfix) with ESMTP id 944A5D7B71 for ; Tue, 30 Aug 2005 15:37:30 -0300 (ADT) Received: (from smtp@localhost) by ll.mit.edu (8.12.10/8.8.8) id j7UIbTtY003609 for ; Tue, 30 Aug 2005 14:37:29 -0400 (EDT) Received: from UNKNOWN( ), claiming to be "sty.llan" via SMTP by llmail, id smtpdAAAddaahb; Tue Aug 30 14:36:19 2005 Date: Tue, 30 Aug 2005 14:36:18 -0400 From: george young To: pgsql-performance@postgresql.org Subject: Re: Observation about db response time Message-Id: <20050830143618.2c10144d.gry@ll.mit.edu> In-Reply-To: <2527.192.168.1.175.1125158337.squirrel@mailserv> References: <2527.192.168.1.175.1125158337.squirrel@mailserv> Reply-To: gry@ll.mit.edu Organization: MIT Lincoln Laboratory X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.8.0; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.019 required=5 tests=[AWL=0.019] X-Spam-Level: X-Archive-Number: 200508/535 X-Sequence-Number: 14282 On Sat, 27 Aug 2005 21:28:57 +0530 (IST) threw this fish to the penguins: > Hello Friends, > We were having a database in pgsql7.4. The database was responding very > slowly even after full vacuum (select > count(*) from some_table_having_18000_records was taking 18 Sec). One comment here: "select count(*)" may seem like a good benchmark, but it's not generally. If your application really depends on this number, fine. Otherwise, you should measure performance with a real query from your application. The "select count(*)" can be very slow because it does not use indexes. > We took a backup of that db and restored it back. Now the same db on > same PC is responding fast (same query is taking 18 ms). This sounds like some index is getting gooped up. If you do a lot of deleting from tables, your indexes can collect dead space that vacuum can not reclaim. Try in sql "reindex table my_slow_table" for a suspect table. In the contrib directory of the postgresql distribution there is a script called "reindexdb". You can run this to reindex your whole database. I also wonder about file system slowdowns. What hardware/OS/filesystem are you using? -- George -- "Are the gods not just?" "Oh no, child. What would become of us if they were?" (CSL)