Re: planner or statistical bug on 8.5

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: planner or statistical bug on 8.5
Date: 2010-01-12 07:59:46
Message-ID: D425483C2C5C9F49B5B7A41F89441547029626EC@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-
> owner(at)postgresql(dot)org] On Behalf Of Pavel Stehule
> Sent: Monday, January 11, 2010 11:55 PM
> To: PostgreSQL Hackers
> Cc: Tom Lane
> Subject: [HACKERS] planner or statistical bug on 8.5
>
> Hello
>
> I checked query and I was surprised with very strange plan:
>
> postgres=# create table a(a int primary key);
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
> "a_pkey" for table "a"
> CREATE TABLE
> postgres=# create table b(b int primary key);
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
> "b_pkey" for table "b"
> CREATE TABLE
> postgres=# create table c(c int primary key);
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
> "c_pkey" for table "c"
> CREATE TABLE
> postgres=# ANALYZE ;
> ANALYZE
> postgres=# explain select a, b from a,b,c;
> QUERY PLAN
> -----------------------------------------------------------------------
> Nested Loop (cost=0.00..276595350.00 rows=13824000000 width=8)
> -> Nested Loop (cost=0.00..115292.00 rows=5760000 width=8)
> -> Seq Scan on a (cost=0.00..34.00 rows=2400 width=4)
> -> Materialize (cost=0.00..82.00 rows=2400 width=4)
> -> Seq Scan on b (cost=0.00..34.00 rows=2400 width=4)
> -> Materialize (cost=0.00..82.00 rows=2400 width=0)
> -> Seq Scan on c (cost=0.00..34.00 rows=2400 width=0)
> (7 rows)

You have no join columns, so it is a simple product.

Perhaps you meant something like this:
EXPLAIN SELECT a.a, b.b, c.c FROM a a, b b, c c WHERE a.a = b.b AND a.a = c.c

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2010-01-12 08:01:47 Re: damage control mode
Previous Message Pavel Stehule 2010-01-12 07:55:10 planner or statistical bug on 8.5