pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pallav Kalva <pkalva@deg.cc>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query Tuning
Date: Fri, 08 Oct 2004 12:42:56 -0400
Message-ID: <13657.1097253776@sss.pgh.pa.us> (raw)
In-Reply-To: <4166A8E8.4060102@deg.cc>
References: <4166A8E8.4060102@deg.cc>

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



view thread (11+ messages)  latest in thread

Message-ID: <13657.1097253776@sss.pgh.pa.us>
Permalink:  ../13657.1097253776@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13657.1097253776@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pkalva@deg.cc
  Subject: Re: Query Tuning
  In-Reply-To: <13657.1097253776@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox