X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B2DAFD1B436 for ; Mon, 29 Dec 2003 18:47:11 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 56288-05 for ; Mon, 29 Dec 2003 14:46:22 -0400 (AST) Received: from bittern.mail.pas.earthlink.net (bittern.mail.pas.earthlink.net [207.217.120.119]) by svr1.postgresql.org (Postfix) with ESMTP id 5CE99D1B437 for ; Mon, 29 Dec 2003 14:46:21 -0400 (AST) Received: from dpc6682160001.direcpc.com ([66.82.160.1] helo=earthlink.net) by bittern.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 1Ab2PP-0007Sj-00; Mon, 29 Dec 2003 10:46:33 -0800 Message-ID: <3FF07671.7050706@earthlink.net> Date: Mon, 29 Dec 2003 13:46:09 -0500 From: Sean Shanny User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Tom Lane Subject: Re: Question about difference in performance of 2 queries References: <3FF057DF.7000605@earthlink.net> <15476.1072716487@sss.pgh.pa.us> In-Reply-To: <15476.1072716487@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 postgresql.org X-Archive-Number: 200312/308 X-Sequence-Number: 5168 Here is the pg_stats data. The explain analyze queries are still running. select * from pg_stats where tablename = 'f_pageviews' and attname = 'date_key'; schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+-------------+----------+-----------+-----------+------------+-------------------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------+------------- public | f_pageviews | date_key | 0 | 4 | 60 | {335,307,309,336,308,321,314,342,322,316} | {0.0283333,0.0243333,0.0243333,0.0243333,0.024,0.0233333,0.0226667,0.0226667,0.0223333,0.0216667} | {304,311,318,325,329,334,341,346,351,356,363} | 0.345026 (1 row) select * from pg_stats where tablename = 'f_pageviews' and attname = 'content_key'; schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+-------------+-------------+-----------+-----------+------------+------------------+-----------------------+-------------------------------------------------------------------------------------+------------- public | f_pageviews | content_key | 0 | 4 | 983 | {-1,1528483} | {0.749333,0.00166667} | {38966,323835,590676,717061,919148,1091875,1208244,1299702,1375366,1434079,1528910} | 0.103399 (1 row) Thanks. --sean Tom Lane wrote: >Please show EXPLAIN ANALYZE output for your queries, not just EXPLAIN. >Also it would be useful to see the pg_stats rows for the date_key and >content_key columns. > > regards, tom lane > > >