X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 36E8A9F9DD1 for ; Mon, 8 May 2006 11:47:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 39179-05 for ; Mon, 8 May 2006 11:46:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D13599F96B6 for ; Mon, 8 May 2006 11:46:59 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k48EksgI026839; Mon, 8 May 2006 10:46:54 -0400 (EDT) To: "Andrus" cc: pgsql-performance@postgresql.org Subject: Re: Query runs 38 seconds for small database! In-reply-to: References: Comments: In-reply-to "Andrus" message dated "Mon, 08 May 2006 13:59:39 +0300" Date: Mon, 08 May 2006 10:46:54 -0400 Message-ID: <26838.1147099614@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/132 X-Sequence-Number: 18919 "Andrus" writes: > I have small database. However the following query takes 38 (!) seconds to > run. > How to speed it up (preferably not changing table structures but possibly > creating indexes) ? ANALYZE would probably help. > " -> Seq Scan on konto dbkonto (cost=0.00..23.30 rows=1 > width=44) (actual time=0.017..1.390 rows=219 loops=1)" > " Filter: (iseloom = 'A'::bpchar)" Anytime you see a row estimate that far off about a simple single-column condition, it means your statistics are out-of-date. regards, tom lane