Skip site navigation (1) Skip section navigation (2)

Explain reports unexpected results with inheritance

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Explain reports unexpected results with inheritance
Date: 2001-02-14 18:21:02
Message-ID: 200102141821.f1EIL2w67836@hub.org (view raw or flat)
Thread:
Lists: pgsql-bugs
David Lynn (davidl(at)ayamba(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Explain reports unexpected results with inheritance

Long Description
When tab2 inherits tab1, explain in psql will always report a "Seq Scan" on tab2 even if there are appropriate indexes.  Through additional testing, it appears that the index is actually being used based on relative cost numbers, but that explain is just not reporting as such.

Using 7.0.2.

Sample Code
DEV:menu# create table tab1 (col1 int4);
CREATE
DEV:menu# create table tab2 (col2 int4) inherits (tab1);
CREATE
DEV:menu# insert into tab2 (col1, col2) values (1,1);
INSERT 28995 1
DEV:menu# insert into tab2 (col1, col2) values (2,2);
INSERT 28996 1
DEV:menu# create index idx1 on tab2 (col2);
CREATE
DEV:menu# select * from tab2 where col2 = 2;
 col1 | col2
------+------
    2 |    2
(1 row)

DEV:menu# explain select * from tab2 where col2 = 2;
NOTICE:  QUERY PLAN:

Seq Scan on tab2  (cost=0.00..1.02 rows=1 width=8)

EXPLAIN


No file was uploaded with this report


Responses

pgsql-bugs by date

Next:From: David LynnDate: 2001-02-14 18:29:03
Subject: Bug #194 and #195 missing version
Previous:From: pgsql-bugsDate: 2001-02-14 18:13:58
Subject: Sequence increased before constraint check

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group