Databases Reference
In-Depth Information
You can see the corresponding execution plan in the following screenshot:
We can see that only four consistent gets are required to answer this query.
In step 7, we execute two different queries to count the number of rows in the
CUSTOMERS
table,
using
*
and
1
respectively, as the argument of the
COUNT()
function. We have used these
values because it is a common practice, and there is a myth about which performs better.
Let's observe the execution plan in the next screenshot.
When counting using
COUNT(*)
, we have only seven consistent gets, because the optimizer
chooses to use the bitmap index
CUSTOMERS_GENDER_BIX
on the
CUST_GENDER
field to count
rows. In the
BITMAP
CONVERSION
COUNT
step, the engine computes the number of rows in the
table by counting the used bit in the bitmap, as we can see in the following screenshot: