pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mario Weilguni <mweilguni@sime.com>
To: pginfo <pginfo@t1.unisoftbg.com>
Cc: pgsql-general@postgresql.org
Subject: Re: query optimization
Date: Tue, 15 Oct 2002 10:12:13 +0200
Message-ID: <200210151012.13724.mweilguni@sime.com> (raw)
In-Reply-To: <3DABBE6F.67930574@t1.unisoftbg.com>
References: <3DABBE6F.67930574@t1.unisoftbg.com>

> Sort  (cost=37.44..37.44 rows=1 width=1118) (actual
> time=12140.96..12141.02 rows=48 loops=1)
>   ->  Nested Loop  (cost=0.00..37.43 rows=1 width=1118) (actual
> time=115.02..12138.57 rows=48 loops=1)
>         ->  Nested Loop  (cost=0.00..33.42 rows=1 width=886) (actual
> time=0.58..20.77 rows=48 loops=1)
>               ->  Index Scan using i_sklad_ids_doc on a_sklad n
> (cost=0.00..28.58 rows=1 width=760) (actual time=0.36..8.59 rows=48
> loops=1)
>               ->  Index Scan using a_location_pkey on a_location sk
> (cost=0.00..4.82 rows=1 width=126) (actual time=0.09..0.12 rows=1
> loops=48)
>         ->  Seq Scan on a_nomen nom  (cost=0.00..3.45 rows=45 width=232)
> (actual time=0.03..165.45 rows=6702 loops=48)
> Total runtime: 12142.07 msec

It seems the query planner is completly wrong here, look on the line 
Seq Scan on a_nomen nom  (cost=0.00..3.45 rows=45 width=232) (actual time=0.03..165.45 rows=6702 loops=48)

This means the planner expects 45 return rows (guessed from statistics), but actually gets 6702 rows. 

Do "VACUUM ANALYZE a_nomen" and try your query again. 

If it fails:
Do you have a unique index on a_nomen(ids)?

Regards,
	Mario Weilguni


>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html




view thread (48+ messages)  latest in thread

Message-ID: <200210151012.13724.mweilguni@sime.com>
Permalink:  ../200210151012.13724.mweilguni@sime.com/
Also on:    postgresql.org/message-id/200210151012.13724.mweilguni@sime.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-general@postgresql.org
  Cc: mweilguni@sime.com, pginfo@t1.unisoftbg.com
  Subject: Re: query optimization
  In-Reply-To: <200210151012.13724.mweilguni@sime.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