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 573DA9F931E for ; Mon, 8 May 2006 13:18:01 -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 53695-07 for ; Mon, 8 May 2006 13:17:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 030279F931D for ; Mon, 8 May 2006 13:17:49 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 878A13150B; Mon, 8 May 2006 18:17:48 +0200 (MET DST) From: "Andrus" X-Newsgroups: pgsql.performance Subject: Re: Query runs 38 seconds for small database! Date: Mon, 8 May 2006 19:15:36 +0300 Organization: Hub.Org Networking Services Lines: 43 Message-ID: References: <26838.1147099614@sss.pgh.pa.us> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/134 X-Sequence-Number: 18921 >> " -> 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. Than you. I addded ANALYZE command and now query works fast. I see autovacuum: processing database "mydb" messages in log file and I have stats_start_collector = on stats_row_level = on in config file. Why statistics was out-of-date ? Andrus. My postgres.conf file (only uncommented settings are listed): listen_addresses = '*' max_connections = 40 shared_buffers = 1000 log_destination = 'stderr' redirect_stderr = on # Enable capturing of stderr into log log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern. log_rotation_age = 1440 # Automatic rotation of logfiles will log_rotation_size = 10240 # Automatic rotation of logfiles will log_min_error_statement = 'warning' # Values in order of increasing severity: silent_mode = on log_line_prefix = "'%t %u %d %h %p %i %l %x %q'" stats_start_collector = on stats_row_level = on autovacuum = on # enable autovacuum subprocess? lc_messages = 'C' # locale for system error message lc_monetary = 'C' # locale for monetary formatting lc_numeric = 'C' # locale for number formatting lc_time = 'C' # locale for time formatting