Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 7A66A2E0057 for ; Tue, 27 May 2008 11:58:30 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 24280-07 for ; Tue, 27 May 2008 11:58:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from depesz.com (depesz.com [88.198.37.40]) by developer.postgresql.org (Postfix) with ESMTP id 4C6952E003A for ; Tue, 27 May 2008 11:58:23 -0300 (ADT) Received: from depesz by depesz.com with local (Exim 4.63) (envelope-from ) id 1K10d1-0002Ct-6j; Tue, 27 May 2008 16:58:19 +0200 Date: Tue, 27 May 2008 16:58:19 +0200 From: hubert depesz lubaczewski To: mark Cc: pgsql-performance@postgresql.org Subject: Re: [GENERAL] select query takes 13 seconds to run with index Message-ID: <20080527145819.GA7691@depesz.com> Reply-To: depesz@depesz.com References: <82fa9e310805261549m2362fbe8sbf18789938fee833@mail.gmail.com> <483B4729.7050402@emproshunts.com> <82fa9e310805261632y46f306fdh84e2da62ffbd7873@mail.gmail.com> <20080527082201.GA17943@depesz.com> <82fa9e310805270746u56334348m34055cb31219ff45@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <82fa9e310805270746u56334348m34055cb31219ff45@mail.gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/347 X-Sequence-Number: 30315 On Tue, May 27, 2008 at 07:46:05AM -0700, mark wrote: > and then it became super fast!! thanks a lot!!! > my question: > -> is 500 too high? what all does this affect? i usually dont go over 100. it affects number of elements in statistics for fields. you can see the stats in: select * from pg_stats; > -> now increasing this number does it affect only when i am running > analyze commands, or will it slow down inserts and other operations? > EXPLAIN ANALYZE select * from pokes where uid = 578439028 order by id > desc limit 6; it (theoretically) can slow down selects to to the fact that it now has to load more data to be able to plan (i.e. it loads the statistics, and since there are more values - the statistics are larger). generally - in most cases this shouldn't be an issue. additionally - i think that the 2-column index would work in this particular case even better. regards, depesz