Re: difference in query plan when db is restored - Mailing list pgsql-general

From Tom Lane
Subject Re: difference in query plan when db is restored
Date
Msg-id 25719.1337358565@sss.pgh.pa.us
Whole thread Raw
In response to Re: difference in query plan when db is restored  ("John Watts" <jwatts@promotion-update.com>)
Responses Re: difference in query plan when db is restored
List pgsql-general
"John Watts" <jwatts@promotion-update.com> writes:
> Anyone?

I'm still suspicious that you're not really re-ANALYZE'ing the relevant
tables, because there are some discrepancies in the row count estimates
that seem hard to explain otherwise, eg here:

         ->  Index Scan using tblcompanyindidnumber on tblcompany (cost=0.00..8.40 rows=1 width=206) (actual
time=0.003..0.003rows=0 loops=3445) 
               Index Cond: (tblappliccomp.companyid = tblcompany.idnumber)

vs

               ->  Bitmap Heap Scan on tblcompany  (cost=13.07..1774.92 rows=620 width=185) (actual time=0.013..0.013
rows=0loops=3445) 
                     Recheck Cond: (tblappliccomp.companyid = tblcompany.idnumber)
                     ->  Bitmap Index Scan on tblcompanyindidnumber (cost=0.00..12.91 rows=620 width=0) (actual
time=0.011..0.011rows=0 loops=3445) 
                           Index Cond: (tblappliccomp.companyid = tblcompany.idnumber)

That might be caused by missing stats for either tblcompany or
tblappliccomp.  Or perhaps the problem is much different values of
default_statistics_target?

Also, I've got to say that this does not represent good practice:

>  server_version                  | 8.3.0

You're missing eighteen minor-release updates on that server.  We don't
do minor releases just to keep ourselves amused; there are a lot of
rather significant bug fixes that you're missing, possibly including
some that affect this issue.

            regards, tom lane

pgsql-general by date:

Previous
From: Aaron Burnett
Date:
Subject: odd intermittent query hanging issue
Next
From: Steve Crawford
Date:
Subject: Re: odd intermittent query hanging issue