X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3BE3D3A60EB for ; Fri, 28 Jan 2005 20:58:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03411-03 for ; Fri, 28 Jan 2005 20:58:21 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id 8F3A93A5C0F for ; Fri, 28 Jan 2005 20:58:21 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 8F0225612A; Fri, 28 Jan 2005 15:58:15 -0500 (EST) Message-ID: <41FAA76B.7070704@deg.cc> Date: Fri, 28 Jan 2005 15:58:19 -0500 From: Pallav Kalva User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: PERFORM Subject: Re: Poor Performance on Postgres 8.0 References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> <8990.1106931750@sss.pgh.pa.us> <41FA8697.1030200@deg.cc> <22896.1106941715@sss.pgh.pa.us> <41FA992B.2090405@deg.cc> <25930.1106945442@sss.pgh.pa.us> In-Reply-To: <25930.1106945442@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/599 X-Sequence-Number: 10289 On 7.4 I get select * from pg_stats where tablename = 'attribute' and attname = 'fknamestringid'; schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+-----------+----------------+-----------+-----------+------------+-----------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------------------------+------------- common | attribute | fknamestringid | 0 | 4 | 124 | {2524,2434,2523,2599,2595,2592,2596,2528,2586,2446} | {0.132333,0.13,0.0766667,0.0373333,0.0366667,0.0333333,0.031,0.029,0.0263333,0.019} | {2433,2441,2455,2462,2473,2479,2484,2492,2505,2574,2598} | -0.22864 (1 row) On 8 select * from pg_stats where tablename = 'attribute' and attname = 'fknamestringid'; schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+-----------+----------------+-----------+-----------+------------+-----------------------------------------------------+-----------------------------------------------------------------------------------+----------------------------------------------------------+------------- common | attribute | fknamestringid | 0 | 4 | 80 | {2524,2434,2530,2522,2525,2523,2527,2526,2574,2531} | {0.219333,0.199333,0.076,0.0643333,0.0616667,0.05,0.0453333,0.042,0.04,0.0286667} | {2437,2528,2529,2538,2539,2540,2554,2562,2575,2584,2637} | 0.0274016 Tom Lane wrote: >I was able to duplicate this behavior with dummy data that had only a >few distinct values for fknamestringid --- the planner then thinks that >the index probe into attribute will match a lot of rows and hence take a >long time. Could we see your pg_stats row for fknamestringid, ie > >select * from pg_stats >where tablename = 'attribute' and attname = 'fknamestringid'; > >It would be interesting to see the same for your 7.4 installation too. > > regards, tom lane > > >