Re: index scan forward vs backward = speed difference of 357X slower!

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Kevin Traster" <ktraster(at)freshgrillfoods(dot)com>, "Merlin Moncure" <mmoncure(at)gmail(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>,"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: index scan forward vs backward = speed difference of 357X slower!
Date: 2012-02-08 23:41:06
Message-ID: 4F32B3B20200002500045085@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Kevin Traster <ktraster(at)freshgrillfoods(dot)com> wrote:

> I have indexes also on activity and mfiled (both btree) - wouldn't
> the database use them? - Kevin

It will use them if they are part of the plan which had the lowest
cost when it compared the costs of all possible plans.

You haven't really shown us the schema, so there's more guesswork
involved in trying to help you than there could be. This page might
be worth reviewing:

http://wiki.postgresql.org/wiki/SlowQueryQuestions

In particular, if there are indexes that aren't being used which you
think should be, there is a good chance that either there is a type
mismatch or your costing factors may need adjustment.

-Kevin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2012-02-09 00:50:46 Re: random_page_cost = 2.0 on Heroku Postgres
Previous Message Kevin Traster 2012-02-08 23:31:50 Re: index scan forward vs backward = speed difference of 357X slower!