Re: 500x speed-down: Wrong query plan? - Mailing list pgsql-performance

From Matteo Beccati
Subject Re: 500x speed-down: Wrong query plan?
Date
Msg-id 43C27AFA.7060604@beccati.com
Whole thread Raw
In response to 500x speed-down: Wrong query plan?  (Alessandro Baretta <a.baretta@barettadeit.com>)
Responses Re: 500x speed-down: Wrong query plan?  (Alessandro Baretta <a.baretta@barettadeit.com>)
List pgsql-performance
Hi Alessandro,

>  Nested Loop  (cost=0.00..1017.15 rows=1 width=1146) (actual
> time=258.648..258.648 rows=0 loops=1)
>    ->  Seq Scan on ubicazione  (cost=0.00..1011.45 rows=1 width=536)
> (actual time=0.065..51.617 rows=12036 loops=1)
>          Filter: ((id_ente = 'dmd'::text) AND (allarme IS NULL) AND
> (manutenzione IS NULL))

The problem seems here. The planner expects one matching row (and that's
why it chooses a nested loop), but 12036 rows are matching this condition.

Are you sure that you recentrly ANALYZED the table "ubicazione"? If so,
try to increase statistics for the id_ente column.


P.S.
There is also an italian mailing list, if you are interested :)

Best regards
--
Matteo Beccati
http://phpadsnew.com
http://phppgads.com

pgsql-performance by date:

Previous
From: Kelly Burkhart
Date:
Subject: Re: help tuning queries on large database
Next
From: Jaime Casanova
Date:
Subject: Re: 500x speed-down: Wrong query plan?