Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 081281A6A984 for ; Sat, 21 Jul 2012 05:02:43 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SsUeA-00030H-3I for pgsql-performance@postgresql.org; Sat, 21 Jul 2012 08:02:42 +0000 Received: by pbbrp8 with SMTP id rp8so7504154pbb.19 for ; Sat, 21 Jul 2012 01:02:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:x-gm-message-state; bh=y3kK2vZzo82yXbCFDxiS3bB8wO+xS08JReB4T4vYyWo=; b=mR7OczgpbRY7iFjyN8iE1eCw6crjH5Zjv/IhWW+cSejUIG3eZj8p8KVhDW06z1j7Qr vQqtS/GOuCJayvmOVWhboCMCUZcJrUAriPJB/BSJ2O97enWUBzN6/sbwH7V+tx4ULtzq MBZO272iZVH8HH9hjwH8RiVwFoL46GjvLXViF45oq3oJ4Ln94U4kI/vYA8O5I3dLl3li PcSDvuW4NyivWion0yv4i7kriZBbgbl83quREiG+eWH6k338+5zOyGfrkf+FI6/g2JJu 09/c4qzBmJG66aUGj1qUHHj144GC9G810Wp+bduxzLqjAWe4WBEiTfLSpMNJ7zdCGoJa BOkA== Received: by 10.66.78.42 with SMTP id y10mr16922738paw.31.1342857746829; Sat, 21 Jul 2012 01:02:26 -0700 (PDT) Received: from ayaki.localdomain (124-169-186-146.dyn.iinet.net.au. [124.169.186.146]) by mx.google.com with ESMTPS id ti1sm5600153pbc.74.2012.07.21.01.02.24 (version=SSLv3 cipher=OTHER); Sat, 21 Jul 2012 01:02:25 -0700 (PDT) Message-ID: <500A620D.4030505@ringerc.id.au> Date: Sat, 21 Jul 2012 16:02:21 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Ioannis Anagnostopoulos CC: pgsql-performance@postgresql.org Subject: Re: A very long running query.... References: <5007FC82.9070007@anatec.com> <5009CB5A.7070801@anatec.com> <5009CD43.8000300@anatec.com> <5009D36A.10506@anatec.com> <5009D963.9040005@anatec.com> In-Reply-To: <5009D963.9040005@anatec.com> Content-Type: multipart/alternative; boundary="------------090009010807000105000801" X-Gm-Message-State: ALoCoQknBIRd+E4tP2y+oXP0atlgzAB4de9Y2/h7YQmiZU+oSF3bEogSJ7zNdLCbe4qaRr8auy62 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/251 X-Sequence-Number: 47432 This is a multi-part message in MIME format. --------------090009010807000105000801 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 07/21/2012 06:19 AM, Ioannis Anagnostopoulos wrote: > On this Ubuntu installation the default_statistics_target = 1000 and > not 100. Do you think that this might be an issue? Nope. You should generally avoid setting default_statistics_target too high anyway; leave it where it is and use ALTER TABLE ... ALTER COLUMN ... SET STATISTICS to raise the targets on columns where you're seeing bad statistics estimates. http://www.postgresql.org/docs/9.1/static/sql-altertable.html Also make sure autovaccum is running frequently so it keeps the stats up to date. -- Craig Ringer --------------090009010807000105000801 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 07/21/2012 06:19 AM, Ioannis Anagnostopoulos wrote:

On this Ubuntu installation the default_statistics_target = 1000 and not 100. Do you think that this might be an issue?

Nope. You should generally avoid setting default_statistics_target too high anyway; leave it where it is and use ALTER TABLE ... ALTER COLUMN ... SET STATISTICS to raise the targets on columns where you're seeing bad statistics estimates.

http://www.postgresql.org/docs/9.1/static/sql-altertable.html

Also make sure autovaccum is running frequently so it keeps the stats up to date.

--
Craig Ringer


--------------090009010807000105000801--