Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 630449FBAF4 for ; Fri, 9 Mar 2007 11:44:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 70720-03 for ; Fri, 9 Mar 2007 11:44:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.telefor.hu (mail.telefor.hu [193.68.53.97]) by postgresql.org (Postfix) with ESMTP id 005AF9FB591 for ; Fri, 9 Mar 2007 11:44:20 -0400 (AST) Received: from telefor-server.int.telefor-new.hu (telefor-server.int.telefor-new.hu [10.0.20.100]) by mail.telefor.hu (Postfix) with ESMTP id BA9611C09F; Fri, 9 Mar 2007 16:44:18 +0100 (CET) Received: from [10.0.20.33] ([10.0.20.33]) by telefor-server.int.telefor-new.hu with Microsoft SMTPSVC(6.0.3790.1830); Fri, 9 Mar 2007 16:44:18 +0100 Message-ID: <45F180D2.5080201@telefor.hu> Date: Fri, 09 Mar 2007 16:44:18 +0100 From: =?UTF-8?B?TWV6ZWkgWm9sdMOhbg==?= Organization: Telefor kft. User-Agent: Thunderbird 2.0b2 (Windows/20070116) MIME-Version: 1.0 To: Richard Huxton CC: pgsql-performance@postgresql.org Subject: Re: Deceiding which index to use References: <45F15F0F.8080403@telefor.hu> <45F1715E.1050000@archonet.com> <45F174CF.8010302@telefor.hu> <45F1775A.8030701@archonet.com> <45F179AB.7040000@telefor.hu> <45F17B70.60001@archonet.com> In-Reply-To: <45F17B70.60001@archonet.com> Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 09 Mar 2007 15:44:18.0533 (UTC) FILETIME=[CC7B4950:01C76261] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.385 tagged_above=0 required=5 tests=AWL, BAYES_50, HTML_30_40, HTML_MESSAGE, MIME_HTML_ONLY X-Spam-Level: X-Archive-Number: 200703/198 X-Sequence-Number: 23603 Richard Huxton wrote:
Re: [PERFORM] Deceiding which index to use

OK - so the next place to look is the distribution of values for
subscriber_id on the output_message_log. Does that have some subscribers
with many rows and lots with hardly any?

Hmm... There are about 1.5k subscribers with 100-200 messages each - all the other 19k has an average of 8.9 messages, most of them having only 1 message. I think that's exactly the situation you mention...

If so, you might need to
increase the stats on that column:

ALTER TABLE output_message_log ALTER COLUMN subscriber_id SET STATISTICS
<num>;
ANALYSE output_message_log (subscriber_id);

The <num> defaults to 10, but can be set as high as 1000. You want to
try and capture the "big" subscribers.

So if I'm correct: this statistics gathering can be fine tuned, and if i set the <num> to 1000 then not only the first 10 subsribers (with most messages) will be stored in pg_stats, but the first 1000? Is 1000 a hard-coded highest-possible-value? I think it would be best to set that to simething like 1800-1900 as I have about that many subscibers with high message count.

Zizi