Re: wrong query plan in 7.1beta3

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>
Cc: <pgsql-hackers(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: wrong query plan in 7.1beta3
Date: 2001-01-27 14:45:08
Message-ID: Pine.LNX.4.30.0101271543400.1492-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Kovacs Zoltan writes:

> There seems to be an optimizer problem in 7.1beta3. The query you can see
> below worked fast in 7.0.2 but in 7.1beta3 is rather slow. The problem is
> that an 'index scan' has been changed to a 'seq scan'. Details:

> Subquery Scan sd_user_grant (cost=38.68..38.85 rows=1 width=61)
> -> Aggregate (cost=38.68..38.85 rows=1 width=61)
> -> Group (cost=38.68..38.73 rows=10 width=61)
> -> Sort (cost=38.68..38.68 rows=10 width=61)
> -> Nested Loop (cost=0.00..38.51 rows=10 width=61)
> -> Seq Scan on pg_shadow (cost=0.00..1.01 rows=1 width=32)
> -> Seq Scan on sd_grant (cost=0.00..20.00 rows=1000 width=29)

You haven't VACUUM ANALYZE'd the sd_grant table. Therefore the row
estimate is way off (1000 vs 6) and thus a sequential scan is (correctly)
thought to be faster.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fred Yankowski 2001-01-27 14:49:46 plan for running postmaster directly as NT service
Previous Message Peter Eisentraut 2001-01-27 14:25:03 Ungraceful handling of fatal flex errors

Browse pgsql-sql by date

  From Date Subject
Next Message John Reid 2001-01-27 15:13:33 Re: abstract data types?
Previous Message Kovacs Zoltan 2001-01-27 14:05:45 wrong query plan in 7.1beta3