Adopted Bitmaps example now on Open Exchange
This is a coding example working on Caché 2018.1.3 and IRIS 2020.2 It will not be kept in sync with new versions It is also NOT serviced by InterSystems Support !
The base class Bmap.Person defines persons within an organization distributed
by various countries. All records are indexed by (Country, PersonalId).
The idea is to separate data by country and have an easy way to MERGE it into a common Repository
As you know this structure doesn't allow the use of bitmaps.
So a wrapper class Bmap.PersonQ around the data eliminates the top level of
the index (Country) and isolates the PersonId (%Integer, MINVAL=1) as its IdKey
Now you are ready to use a Bitmap index.
A few performance figures on 300010 generated records.
You see also that Relative Cost is sometimes quite misleading.
At the end of the day, the count of Global references and Lines Executed is the truth.
Test #1: total count for a specific country
Test #2: Persons with a specifc Home_State
Test #3: Persons by Home_State
Here it is obvious that grouping takes quite a significant part of lines executed.