Re: Bad plan on a huge table query - Mailing list pgsql-general

From Jeff Janes
Subject Re: Bad plan on a huge table query
Date
Msg-id CAMkU=1yRdK47wGEEnQ2O1n62VMmMtC__vPSB+Frgxk5uFBLBhg@mail.gmail.com
Whole thread Raw
In response to Re: Bad plan on a huge table query  (Daniel Cristian Cruz <danielcristian@gmail.com>)
List pgsql-general
On Thu, Mar 21, 2013 at 10:53 AM, Daniel Cristian Cruz <danielcristian@gmail.com> wrote:
And now, it runs, at least:


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

pgsql-general by date:

Previous
From: Roberto Scattini
Date:
Subject: Re: streaming replication question
Next
From: Daniel Cristian Cruz
Date:
Subject: Re: Bad plan on a huge table query