Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report