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