BUG #3826: Very Slow Execution of examplequery (wrong plan?)

From: "Alexander Steffens" <mail(at)a-st(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3826: Very Slow Execution of examplequery (wrong plan?)
Date: 2007-12-18 19:22:26
Message-ID: 200712181922.lBIJMQps082162@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3826
Logged by: Alexander Steffens
Email address: mail(at)a-st(dot)de
PostgreSQL version: 8.3b4
Operating system: Win2003R2x64
Description: Very Slow Execution of examplequery (wrong plan?)
Details:

Hello, I have found an Query (with data)
that need to execute on MS-SQL 2005 < 9sec,
on Postgresql I will stop it now after more than 30 mins:

create table t1 (a int);
create table t2 (a int);

insert into t1 select 1; --for t-sql compat
insert into t1 select 2;insert into t1 select 3;

insert into t2 select 1;
insert into t2 select 2;
insert into t2 select 5;

--execute 8 times QUERY A
insert into t1
select distinct (t1.a + t2.a)*2
from t1,t2
where not exists (
select * from t1 tt where tt.a = (t1.a + t2.a)*2
)

--execute 1 times
insert into t2
select distinct (t1.a + t2.a)*3
from t1,t2
where not exists (
select * from t2 tt where tt.a = (t1.a + t2.a)*3
)

--
--data now t1: 1642 t2: 3301
--
--now again QUERY A
--will need much too much time:
insert into t1
select distinct (t1.a + t2.a)*2
from t1,t2
where not exists (
select * from t1 tt where tt.a = (t1.a + t2.a)*2
)

Alex.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Gregory Stark 2007-12-18 20:21:50 Re: BUG #3826: Very Slow Execution of examplequery (wrong plan?)
Previous Message Tom Lane 2007-12-18 19:08:33 Re: Bug (#3484) - Invalid page header again