Re: Indexscan is only used if we use "limit n"

From: joao <joao(dot)junior(at)bra03034(dot)conab(dot)gov(dot)br>
To: sebaioni-postgresql(at)yahoo(dot)com(dot)ar
Cc: Performance PostgreSQL <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Indexscan is only used if we use "limit n"
Date: 2007-08-15 20:02:43
Message-ID: 1187208163.22811.0.camel@waimea
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


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..

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Lewis 2007-08-15 20:03:10 Re: Indexscan is only used if we use "limit n"
Previous Message Alvaro Herrera 2007-08-15 20:00:39 Re: Indexscan is only used if we use "limit n"