Re: Bogus nestloop rows estimate in 8.4.7 - Mailing list pgsql-hackers

From Marti Raudsepp
Subject Re: Bogus nestloop rows estimate in 8.4.7
Date
Msg-id CABRT9RCnzAPZ-C3LcQQxj+Z80sxAzpaJ1AUR46+JdNHv4tJ9dw@mail.gmail.com
Whole thread Raw
In response to Re: Bogus nestloop rows estimate in 8.4.7  (Marti Raudsepp <marti@juffo.org>)
Responses Re: Bogus nestloop rows estimate in 8.4.7
List pgsql-hackers
On Mon, May 28, 2012 at 10:32 PM, Marti Raudsepp <marti@juffo.org> wrote:
> There was a similar case in 9.0.4 with WHERE i=1, but that has been
> fixed in 9.0.7

Oh, it's been fixed in 9.0.7, but apparently not in 8.4.11; the empty
parent tables are confusing the estimate:

explain select * from a_parent join b_parent using (i) where i=1;

QUERY PLAN
Nested Loop  (cost=56.57..123.65 rows=224 width=4) ->  Append  (cost=0.00..62.60 rows=16 width=4)       ->  Seq Scan on
b_parent (cost=0.00..40.00 rows=12 width=4)             Filter: (i = 1)       ->  Index Scan using b2_i_idx on b_child2
b_parent
(cost=0.00..11.30 rows=2 width=4)             Index Cond: (i = 1)       ->  Index Scan using b1_i_idx on b_child1
b_parent
(cost=0.00..11.30 rows=2 width=4)             Index Cond: (i = 1) ->  Materialize  (cost=56.57..56.71 rows=14 width=4)
    ->  Append  (cost=0.00..56.56 rows=14 width=4)             ->  Seq Scan on a_parent  (cost=0.00..40.00 rows=12
width=4)                  Filter: (i = 1)             ->  Index Scan using a1_i_idx on a_child1 a_parent
 
(cost=0.00..8.28 rows=1 width=4)                   Index Cond: (i = 1)             ->  Index Scan using a2_i_idx on
a_child2a_parent
 
(cost=0.00..8.28 rows=1 width=4)                   Index Cond: (i = 1)

Regards,
Marti


pgsql-hackers by date:

Previous
From: Marti Raudsepp
Date:
Subject: Re: Bogus nestloop rows estimate in 8.4.7
Next
From: Alexander Korotkov
Date:
Subject: WIP: 2d-mapping based indexing for ranges