Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 860711337B6E for ; Thu, 3 Feb 2011 05:55:01 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 91175-06 for ; Thu, 3 Feb 2011 09:54:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com [209.85.161.46]) by mail.postgresql.org (Postfix) with ESMTP id 14B9E1337B68 for ; Thu, 3 Feb 2011 05:54:52 -0400 (AST) Received: by fxm20 with SMTP id 20so992660fxm.19 for ; Thu, 03 Feb 2011 01:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=ypqvqcLqTnd4WvetEkG5g+cpIGjUBVb9g6As6ahQMog=; b=JGgMGMbOwxztOLMEaumg+wtmBQQhlW2hrRZpl2d6f2hYXRrqYzCuke0qXDjAYwW/Nk iDT81+PW70wCQMdoampnW/6NsbMr/+1GK1iIfePp3oSX7oe8ePXHa6KVUxJUxAnoQRxn aNJ3S3ztjQM+rY1nGbLiLSZOpmjaBmwjhUCjA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=PIzgI6kMR1LFpOgQ6UqyWm7ekFC5zL3Eoa41EiUKk7jggc0xs3yNICw30F5OYe4d+2 NPlS+n0HL8SJ1wiUwlg8JHHWmFb2iYczfC2htwDJWHiak8o1ZvkzQPbHft/spFG3NqEo R9CLGAeubVNRDki+ROJIbb3tVA5l5LBOsket4= Received: by 10.223.114.14 with SMTP id c14mr9672448faq.103.1296726892394; Thu, 03 Feb 2011 01:54:52 -0800 (PST) Received: from [10.1.1.57] (skuns.zoral.com.ua [91.193.166.194]) by mx.google.com with ESMTPS id l3sm66167fan.2.2011.02.03.01.54.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 03 Feb 2011 01:54:50 -0800 (PST) Message-ID: <4D4A7B69.2020704@gmail.com> Date: Thu, 03 Feb 2011 11:54:49 +0200 From: Vitalii Tymchyshyn User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Robert Haas CC: Jon Nelson , Mladen Gogala , Andrew Dunstan , Bruce Momjian , Tom Lane , "david@lang.hm" , Craig Ringer , "pgsql-performance@postgresql.org" Subject: Re: [HACKERS] Slow count(*) again... References: <201102012247.p11Ml6u02682@momjian.us> <4D48914B.4050403@dunslane.net> <4D489AD1.1010105@vmsinfo.com> <4D499E55.4020107@vmsinfo.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.046 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=1.553, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201102/67 X-Sequence-Number: 42205 02.02.11 20:32, Robert Haas написав(ла): > > Yeah. Any kind of bulk load into an empty table can be a problem, > even if it's not temporary. When you load a bunch of data and then > immediately plan a query against it, autoanalyze hasn't had a chance > to do its thing yet, so sometimes you get a lousy plan. May be introducing something like 'AutoAnalyze' threshold will help? I mean that any insert/update/delete statement that changes more then x% of table (and no less then y records) must do analyze right after it was finished. Defaults like x=50 y=10000 should be quite good as for me. Best regards, Vitalii Tymchyshyn