Re: Sub-optimal plan chosen

From: bricklen <bricklen(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Sub-optimal plan chosen
Date: 2009-09-10 18:02:48
Message-ID: 33b743250909101102kbd38b4an67d89274c053402e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Sep 10, 2009 at 10:56 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> bricklen <bricklen(at)gmail(dot)com> writes:
> > I just created a new index as Tom said, and the query *does* use the new
> > index (where ofid precedes date in the definition).
>
> And is it indeed faster than the other alternatives?
>
> regards, tom lane
>

About the same as the earlier, faster plan:

Aggregate (cost=2342.79..2342.80 rows=1 width=8) (actual time=8.433..8.433
rows=1 loops=1)
-> Index Scan using statsdaily_ofid_date on statsdaily
(cost=0.00..2330.61 rows=4873 width=8) (actual time=0.089..5.043 rows=3125
loops=1)
Index Cond: ((ofid = 38) AND (date >= '2009-09-01'::date) AND (date
<= '2999-01-01'::date))
Total runtime: 8.470 ms

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message A. Kretschmer 2009-09-11 05:33:08 Re: PSQL 8.4 - partittions - join tables - not optimal plan
Previous Message Tom Lane 2009-09-10 17:56:07 Re: Sub-optimal plan chosen