From: Scott Marlowe <scott.marlowe@gmail.com>
To: S Golly <gollykai@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: performance index scan vs bitmap-seq scan.
Date: Thu, 20 Dec 2007 16:15:36 -0600
Message-ID: <dcc563d10712201415l60c8fb9fv7e5723c4856a1550@mail.gmail.com> (raw)
In-Reply-To: <4a5f56930712201406r3a3b4810v96f30ef4c2fb6310@mail.gmail.com>
References: <4a5f56930712201406r3a3b4810v96f30ef4c2fb6310@mail.gmail.com>
On Dec 20, 2007 4:06 PM, S Golly <gollykai@gmail.com> wrote:
> The server is running 8.2.5 FreeBSD 6.1 with 3 GB of RAM.
> I have a table with over 100M rows. I have a unique index (primary key) on
> column name called aid.
> The select count(aid) .. does a Bitmap heap scan when the right side
> condition is above 100,000,000 (if i take one zero off it does a pure index
> scan).
> My question : why is the optimizer choosing an Bitmap Heap Scan when count
> can be done with index.
Because count can't be done with the index alone.
In pgsql the visibility info is in the table itself, so even if it can
hit the index, it has to go back and hit the table to be sure if the
tuple is visible.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: scott.marlowe@gmail.com, gollykai@gmail.com
Subject: Re: performance index scan vs bitmap-seq scan.
In-Reply-To: <dcc563d10712201415l60c8fb9fv7e5723c4856a1550@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox