pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Russell Smith <mr-russ@pws.com.au>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: David West <david.west@cusppoint.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: limit clause breaks query planner?
Date: Tue, 02 Sep 2008 13:54:53 +1000
Message-ID: <48BCB90D.8090606@pws.com.au> (raw)
In-Reply-To: <162867790809011217n587e6090qdec2c4c6a1f580e6@mail.gmail.com>
References: <1683189597512580954@unknownmsgid>
	<162867790809010552o624a347aif0eb5fc71e7bbad@mail.gmail.com>
	<2934211014530751484@unknownmsgid>
	<162867790809011217n587e6090qdec2c4c6a1f580e6@mail.gmail.com>

Pavel Stehule wrote:
> Hello
>
> 2008/9/1 David West <david.west@cusppoint.com>:
>   
>> Thanks for your suggestion but the result is the same.
>>
>> Here is the explain analyse output from different queries.
>> Select * from my_table where A is null and B = '21' limit 15
>>
>> "Limit  (cost=0.00..3.68 rows=15 width=128) (actual time=85837.043..85896.140 rows=15 loops=1)"
>> "  ->  Seq Scan on my_table this_  (cost=0.00..258789.88 rows=1055580 width=128) (actual time=85837.038..85896.091 rows=15 loops=1)"
>> "        Filter: ((A IS NULL) AND ((B)::text = '21'::text))"
>> "Total runtime: 85896.214 ms"
>>
>>     
[snip]

Further to Pavel's comments;

(actual time=85837.038..85896.091 rows=15 loops=1)

That's 85 seconds on a sequence scan to return the first tuple.  The table is not bloated by any chance is it?

Regards

Russell






view thread (26+ messages)  latest in thread

Message-ID: <48BCB90D.8090606@pws.com.au>
Permalink:  ../48BCB90D.8090606@pws.com.au/
Also on:    postgresql.org/message-id/48BCB90D.8090606@pws.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mr-russ@pws.com.au, pavel.stehule@gmail.com, david.west@cusppoint.com
  Subject: Re: limit clause breaks query planner?
  In-Reply-To: <48BCB90D.8090606@pws.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox