Re: limit clause breaks query planner?

From: Russell Smith <mr-russ(at)pws(dot)com(dot)au>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: David West <david(dot)west(at)cusppoint(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: limit clause breaks query planner?
Date: 2008-09-02 03:54:53
Message-ID: 48BCB90D.8090606@pws.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Pavel Stehule wrote:
> Hello
>
> 2008/9/1 David West <david(dot)west(at)cusppoint(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Smith 2008-09-02 05:32:01 Re: too many clog files
Previous Message Duan Ligong 2008-09-02 01:38:21 Re: too many clog files