[HACKERS] bitset counting as a user defined function in postgresql 9.2?

2013-08-24 Thread Kanarupan Kularatnarajah
As an initial attempt to try hands-on with postgresql, I've learned on user created functions and some other internals of postgresql. Few materials on postgresql indicate that the aggregate functions are slow due to some internal reasons (index covering, null etc). I'm looking forward to

[HACKERS] What is the algorithm used for counting the set bit (number of ones) of a bitmap/bitarray/betset in postgresql?

2013-08-24 Thread Kanarupan Kularatnarajah
I've come across lookup tables, Hamming weights and Brain Kernighan's Algo. Are they used (combined or separately) in bitmap counting? Where can I find the coding and please explain the flow a count function (for a bit counting) via coding rather than the high level architectural diagrams (which