pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matteo Beccati <php@beccati.com>
To: Alessandro Baretta <a.baretta@barettadeit.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: 500x speed-down: Wrong query plan?
Date: Mon, 09 Jan 2006 16:02:18 +0100
Message-ID: <43C27AFA.7060604@beccati.com> (raw)
In-Reply-To: <43C26A5F.7040702@barettadeit.com>
References: <43C26A5F.7040702@barettadeit.com>

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



view thread (7+ messages)  latest in thread

Message-ID: <43C27AFA.7060604@beccati.com>
Permalink:  ../43C27AFA.7060604@beccati.com/
Also on:    postgresql.org/message-id/43C27AFA.7060604@beccati.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: php@beccati.com, a.baretta@barettadeit.com
  Subject: Re: 500x speed-down: Wrong query plan?
  In-Reply-To: <43C27AFA.7060604@beccati.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox