Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use MySQL bitmap index to solve the problem of user portrait

Shulou Source: shulou.com Published: 2022-05-31 15:31:04 10月02日 Update

This article is about how to use MySQL bitmap index to solve the problem of user portraits. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Each bigint type includes 60 recorded bit information.

But bit 0 represents the bit of the 60th record

Bits 1 to 59 represent the bit information of the first to 59 records.

In this way, the bit information recorded is not continuous.

When using it, you have to move the rightmost bit to the leftmost, which is difficult to understand and has a loss of performance.

After the improvement of Wang Gong

Using the following sql replacement, the saved bit information is continuous.

SELECT CEIL (id / 60) G60, CEIL (id / 1200) g1200, age grouped, COUNT (*) total, BIT_OR (1

Tags: Information bitmap index user portrait question content more article good practical bad right performance overall article time look knowledge type Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Huawei Shulou Information Docker MySQL