Re: Query Tuning - Mailing list pgsql-performance

From Tom Lane
Subject Re: Query Tuning
Date
Msg-id 13657.1097253776@sss.pgh.pa.us
Whole thread Raw
In response to Query Tuning  (Pallav Kalva <pkalva@deg.cc>)
Responses Re: Query Tuning  (Pallav Kalva <pkalva@deg.cc>)
List pgsql-performance
Pallav Kalva <pkalva@deg.cc> writes:
>       I have a problem with the below query, when i do explain on the
> below query on my live database it doesnt use any index specified on the
> tables and does seq scan on the table which is 400k records. But if i
> copy the same table onto a different database on a different machine it
> uses all the indexes specified and query runs much quicker.

It looks to me like you've never vacuumed/analyzed the copy, and so you
get a different plan there.  The fact that that plan is better than the
one made with statistics is unhappy making :-( ... but when you only
show us EXPLAIN output rather than EXPLAIN ANALYZE, it's impossible to
speculate about why.  Also, what PG version is this?

            regards, tom lane

pgsql-performance by date:

Previous
From: Pallav Kalva
Date:
Subject: Query Tuning
Next
From: Pallav Kalva
Date:
Subject: Re: Query Tuning