explain doubt - Mailing list pgsql-general

From Luca Ferrari
Subject explain doubt
Date
Msg-id CAKoxK+5PAupy2n4JK9i+ggXSRwnhyfoik7GvqR0Y-afMaUm21g@mail.gmail.com
Whole thread Raw
Responses Re: explain doubt  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi all,
imagine the following simple situation:

# CREATE TABLE test( pk serial not null, description text, primary key(pk));
# INSERT INTO test(pk) VALUES(generate_series(1,1000000 ) );
# VACUUM FULL ANALYZE test;
# EXPLAIN SELECT * FROM test WHERE pk = 1 OR pk = 100;
                                  QUERY PLAN
------------------------------------------------------------------------------
 Bitmap Heap Scan on test  (cost=8.69..16.59 rows=2 width=36)
   Recheck Cond: ((pk = 1) OR (pk = 100))
   ->  BitmapOr  (cost=8.69..8.69 rows=2 width=0)
         ->  Bitmap Index Scan on test_pkey  (cost=0.00..4.35 rows=1
width=0)
               Index Cond: (pk = 1)
         ->  Bitmap Index Scan on test_pkey  (cost=0.00..4.35 rows=1
width=0)
               Index Cond: (pk = 100)

Now, what is the .35 in the cost of the bitmap index scan nodes? I
mean it seems that the system has to walk 23 index tuples on each
index page but I'm not sure about this, does it mean that this is the
tree high? Since the value is the same for both the first and a
"middle" key I suspect it is an average count, but on what?

Thanks

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Help, server doesn't start
Next
From: Tom Lane
Date:
Subject: Re: Error message "psql: could not connect to server: No such file or directory"