Re: Bad plan on a huge table query

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Daniel Cristian Cruz <danielcristian(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Bad plan on a huge table query
Date: 2013-03-21 19:30:05
Message-ID: CAMkU=1yRdK47wGEEnQ2O1n62VMmMtC__vPSB+Frgxk5uFBLBhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 21, 2013 at 10:53 AM, Daniel Cristian Cruz <
danielcristian(at)gmail(dot)com> wrote:

> And now, it runs, at least:
>
> http://explain.depesz.com/s/GDJn
>
> No one could send a guess on it?
>

Without showing either the query, or the definition of the tables, you are
not giving us much to go on.

I'm particularly interested in what inicio is and what
idx_aula_confirmacao_2 is. If inicio is already a date, why is being cast
to date? And if it is not already a date, how can it be used in the index
scan?

-> Index Scan using idx_aula_confirmacao_2 on aula_confirmacao
(cost=0.01..7582.88 rows=4442 width=24) (actual time=64.017..81747.794
rows=101508 loops=1)"
Index Cond: (((inicio)::date >=
date_trunc('YEAR'::text, now())) AND ((inicio)::date <= now()))"

Cheers,

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Cristian Cruz 2013-03-21 19:30:43 Re: Bad plan on a huge table query
Previous Message Roberto Scattini 2013-03-21 19:05:07 Re: streaming replication question