Re: Slow Query

From: Joe Lester <joe_lester(at)sweetwater(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow Query
Date: 2006-11-21 19:52:56
Message-ID: 644182CE-DEE9-444F-8AEB-534CAA6D4C64@sweetwater.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Pretty sure. When I ran the queries I was in psql. I ran the first
query. Then I pressed the up arrow to re-run the same query. I did
not notice that about the rows. Might reindexing be in order?

On Jul 14, 2005, at 7:22 AM, Ragnar Hafstað wrote:

> On Thu, 2005-07-14 at 10:06 +1000, Marc McIntyre wrote:
>
>> I'm having a problem with a query that performs a sequential scan
>> on a
>> table when it should be performing an index scan. The interesting
>> thing
>> is, when we dumped the database on another server, it performed an
>> index
>> scan on that server.
> ...
>> The EXPLAIN ANALYZE from the system performing an sequential scan:
>>
>> QUERY PLAN
>> Sort (cost=30079.79..30079.89 rows=42 width=113) (actual
>> time=39889.989..39890.346 rows=260 loops=1)
> ...
>> The EXPLAIN ANALYZE from the system performing an index scan scan:
>> Sort (cost=16873.64..16873.74 rows=40 width=113) (actual
>> time=2169.905..2169.912 rows=13 loops=1)
>
> looks like the first query is returning 260 rows,
> but the second one 13
>
> this may not be your problem, but are you sure you are using the same
> query on the same data here ?
>
> gnari
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Carlos H. Reimer 2006-11-21 23:43:26 Priority to a mission critical transaction
Previous Message Joe Lester 2006-11-21 17:03:34 Slow Query