Re: Please help with this explain analyse... - Mailing list pgsql-performance

From Tom Lane
Subject Re: Please help with this explain analyse...
Date
Msg-id 17298.1133222430@sss.pgh.pa.us
Whole thread Raw
In response to Re: Please help with this explain analyse...  (Bricklen Anderson <BAnderson@PresiNET.com>)
Responses Re: Please help with this explain analyse...  (David Gagnon <dgagnon@siunik.com>)
List pgsql-performance
Bricklen Anderson <BAnderson@PresiNET.com> writes:
> Your loops are what is causing the time spent.
> eg. "actual time=0.127..17.379 rows=1154 loops=8335)" ==
> 8335*(17.379-0.127)/1000=>143 secs (if my math is correct).

As for where the problem is, I think it's the horrid misestimate of the
number of matching rows in cs_pk:

>> "                    ->  Index Scan using cs_pk on cs  (cost=0.00..12.83
>> rows=2 width=144) (actual time=0.087..444.999 rows=13587 loops=1)"
>> "                          Index Cond: (('M'::text = (cs.csypnum)::text)
>> AND ((cs.csglnum)::text = ("outer".glnum)::text))"

Has that table been ANALYZEd recently?  How about the gl table?

            regards, tom lane

pgsql-performance by date:

Previous
From: Bricklen Anderson
Date:
Subject: Re: Please help with this explain analyse...
Next
From: David Gagnon
Date:
Subject: Re: Please help with this explain analyse...