Using RDS for PostgreSQL varbitx Extension for Real-Time Profile Applications

By Digoal

PostgreSQL built-in varbit and bit operation functions are relatively simple. Similarly, varbitx is an Alibaba Cloud ApsaraDB for RDS PostgreSQL extension for these functions. Varbitx supports more bit operations, and can cover more extensive application scenarios, such as real-time user profile recommendation systems, access control advertisement systems, and ticketing systems.

Introduction to Alibaba Cloud Varbitx

Varbitx provides additional functional interfaces as follows:

1. bit_count

2. bit_count

3. bit_count_array

4. bit_fill

5. bit_posite

6. bit_posite

7. get_bit

8. get_bit_array

9. get_bit_array

10. set_bit_array

10.1. set_bit_array

11. set_bit_array

12. set_bit_array_record

13. set_bit_array_record

Using Varbitx

Let’s look at a quick example of using all of the functions for varbitx.

Dictionary Translation — Obtaining Values in Dictionary from Bit Position

Assume that the dictionary ID is imei+id (id is a seamless auto-incrementing ID). How can we obtain the corresponding imei from the bit position?

This SQL is fast. It uses index scanning, and only takes 380 milliseconds to query 1 million records from 100 million.

To learn more about PostgreSQL on Alibaba Cloud, visit

To read more blogs from Digoal or to find related source codes, visit


Follow me to keep abreast with the latest technology news, industry insights, and developer trends.