总数为“ 1”在Postgres位掩码中 [英] Total number of "1s" in a Postgres bitmask

查看:156
本文介绍了总数为“ 1”在Postgres位掩码中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以获取Postgres位字符串类型中1的总数?

Is there a way to get the total number of 1's in a Postgres "bit string" type?

推荐答案

需要它真正有效,请进行以下讨论:有效地确定VARBIT字段的内容中设置的位

If you need it to be really efficient, here's a discussion: Efficiently determining the number of bits set in the contents of, a VARBIT field

这篇关于总数为“ 1”在Postgres位掩码中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆