| От | Jasen Betts |
|---|---|
| Тема | Re: Bit count |
| Дата | |
| Msg-id | helnbl$ggh$1@reversiblemaps.ath.cx обсуждение исходный текст |
| Ответ на | Bit count (Nathaniel Trellice <naptrel@yahoo.co.uk>) |
| Список | pgsql-novice |
On 2009-11-24, Nathaniel Trellice <naptrel@yahoo.co.uk> wrote: > I'd like to use an integer column (16 bits will suffice) to hold a bit-field. I'd like to be able to efficiently countthe number of bits set in this field. > > Is there a built-in function call I can use? (I can't find one in the manual). convert it to a text representation of the binary value use regexp_replace to remove the 0s take the length. > If not, can anyone recommend the most efficient way within postgres to implement the kind of bit-counting tricks foundat: postgres functions can be written in C (if you have superuser priviledges) seems like overkill though.
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера