Re: Help Me Understand Why I'm Getting a Bad Query Plan - Mailing list pgsql-performance

From marcin mank
Subject Re: Help Me Understand Why I'm Getting a Bad Query Plan
Date
Msg-id b1b9fac60903242004p5fe8b68fwd6f1ada767766b21@mail.gmail.com
Whole thread Raw
In response to Re: Help Me Understand Why I'm Getting a Bad Query Plan  (Bryan Murphy <bmurphy1976@gmail.com>)
Responses Re: Help Me Understand Why I'm Getting a Bad Query Plan  (Bryan Murphy <bmurphy1976@gmail.com>)
List pgsql-performance
There is one thing I don`t understand:

              ->  Nested Loop  (cost=0.00..180564.28 rows=1806
width=37) (actual time=0.192..60.214 rows=3174 loops=1)
                    ->  Index Scan using visitors_userid_index2 on
visitors v  (cost=0.00..2580.97 rows=1300 width=33) (actual
time=0.052..2.342 rows=897 loops=1)
                          Index Cond: (userid =
'fbe2537f21d94f519605612c0bf7c2c5'::bpchar)
                    ->  Index Scan using
itemexperiencelog__index__visitorid on itemexperiencelog l
(cost=0.00..134.04 rows=230 width=70) (actual time=0.013..0.040 rows=4
loops=897)
                          Index Cond: (l.visitorid = v.id)

If it expects 1300 visitors with the userid, and for each of them to
have 230 entries in itemexperiencelog, how can it come up with 1806
returned rows (and be about right!)?

Greetings
Marcin

pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Help Me Understand Why I'm Getting a Bad Query Plan
Next
From: Greg Smith
Date:
Subject: Re: Raid 10 chunksize