Re: Limit clause not using index - Mailing list pgsql-performance

From John A Meinel
Subject Re: Limit clause not using index
Date
Msg-id 42B82ED0.1010009@arbash-meinel.com
Whole thread Raw
In response to Re: Limit clause not using index  (Yves Vindevogel <yves.vindevogel@implements.be>)
Responses Re: Limit clause not using index
List pgsql-performance
Yves Vindevogel wrote:

> rvponp=# explain analyze select * from tblPrintjobs order by
> loginuser, desceventdate, desceventtime ;
> QUERY PLAN
>
--------------------------------------------------------------------------------------------------------------------------------
>
> Sort (cost=345699.06..347256.49 rows=622972 width=203) (actual
> time=259438.952..268885.586 rows=622972 loops=1)
> Sort Key: loginuser, desceventdate, desceventtime
> -> Seq Scan on tblprintjobs (cost=0.00..25596.72 rows=622972
> width=203) (actual time=21.155..8713.810 rows=622972 loops=1)
> Total runtime: 271583.422 ms
> (4 rows)


Can you post it with the limit? I realize the query takes a long time,
but that is the more important query to look at.

Also, just as a test, if you can, try dropping most of the indexes
except for the important one. It might be that the planner is having a
hard time because there are too many permutations to try.
I believe if you drop the indexes inside a transaction, they will still
be there for other queries, and if you rollback instead of commit, you
won't lose anything.

BEGIN;
DROP INDEX ...
EXPLAIN ANALYZE SELECT *...
ROLLBACK;

John
=:->


Attachment

pgsql-performance by date:

Previous
From: Yves Vindevogel
Date:
Subject: Re: Limit clause not using index
Next
From: Yves Vindevogel
Date:
Subject: Another question on indexes (drop and recreate)