explain doubt

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: explain doubt
Date: 2012-06-25 13:37:07
Message-ID: CAKoxK+5PAupy2n4JK9i+ggXSRwnhyfoik7GvqR0Y-afMaUm21g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-06-25 13:52:01 Re: Error message "psql: could not connect to server: No such file or directory"
Previous Message Craig Ringer 2012-06-25 13:35:42 Re: Help, server doesn't start