Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 5BE139FA40F for ; Wed, 15 Aug 2007 17:02:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 97652-01 for ; Wed, 15 Aug 2007 17:02:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from dfbsa63.conab.gov.br (dfbsa63.conab.gov.br [200.140.131.205]) by postgresql.org (Postfix) with ESMTP id 62C519F9CB4 for ; Wed, 15 Aug 2007 17:02:41 -0300 (ADT) Received: from [10.1.21.127] (waimea.conab.gov.br [10.1.21.127]) by dfbsa63.conab.gov.br (Postfix) with ESMTP id 4977E9405E; Wed, 15 Aug 2007 17:02:40 -0300 (BRT) Subject: Re: Indexscan is only used if we use "limit n" From: joao To: sebaioni-postgresql@yahoo.com.ar Cc: Performance PostgreSQL In-Reply-To: <377451.48008.qm@web36104.mail.mud.yahoo.com> References: <377451.48008.qm@web36104.mail.mud.yahoo.com> Content-Type: text/plain; charset=iso8859-1 Date: Wed, 15 Aug 2007 17:02:43 -0300 Message-Id: <1187208163.22811.0.camel@waimea> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.238 tagged_above=0 required=5 tests=AWL=0.237, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200708/154 X-Sequence-Number: 26284 which column does your indice cover? Em Qua, 2007-08-15 ŕs 16:36 -0300, Sebastián Baioni escreveu: > Hello, > Whe are running PostgreSQL 8.2.0 on amd64-portbld-freebsd6.2, compiled > by GCC cc (GCC) 3.4.6 [FreeBSD] 20060305. > The query only uses the index if we have a "limit n": > > Without "Limit n" > explain > select esapcuit, esapcuil > from esact00 t1 > order by esapcuit, esapcuil > > Sort (cost=843833.82..853396.76 rows=3825177 width=30) > Sort Key: esapcuit, esapcuil > -> Seq Scan on esact00 t1 (cost=0.00..111813.77 rows=3825177 > width=30) > > With "Limit n" > explain > select esapcuit, esapcuil > from esact00 t1 > order by esapcuit, esapcuil > limit 1 > > Limit (cost=0.00..1.86 rows=1 width=30) > -> Index Scan using uesact002 on esact00 t1 (cost=0.00..7129736.89 > rows=3825177 width=30) > > Our postgresql.conf is: > enable_bitmapscan = on > enable_hashagg = on > enable_hashjoin = on > enable_indexscan = on > enable_mergejoin = on > enable_nestloop = on > enable_seqscan = on > enable_sort = on > enable_tidscan = on > > Thank you. > Sebastián > > > Sebastián Baioni > http://www.acomplejados.com.ar > http://www.extremista.com.ar > http://www.coolartists.com.ar > > > ______________________________________________________________________ > > ˇSé un mejor ambientalista! > Encontrá consejos para cuidar el lugar donde vivimos..