Re: 500x speed-down: Wrong query plan?

From: Matteo Beccati <php(at)beccati(dot)com>
To: Alessandro Baretta <a(dot)baretta(at)barettadeit(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: 500x speed-down: Wrong query plan?
Date: 2006-01-09 15:02:18
Message-ID: 43C27AFA.7060604@beccati.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jaime Casanova 2006-01-09 15:30:21 Re: 500x speed-down: Wrong query plan?
Previous Message Kelly Burkhart 2006-01-09 14:37:04 Re: help tuning queries on large database