https://github.com/buzzm/postgresbson/blob/main/pgbson--2.0....
and this:
https://github.com/buzzm/postgresbson/blob/main/pgbson.c
Really nice stuff.
It is not meant for large reporting formats like live charts etc. These parsers can be unstable if they ignore type checks, precedence, and nesting depth.
The original libbson author wouldn't give me a donation link on inquiry, as they probably thought it was some sort of scam. The library merged into mongoDB years ago. Would not touch mongoDB now days given its current license, and propensity to implode key structures on upgrades. =)
This part is misinformation, as json[b] works perfectly fine with decimals (well, Numeric, which is an arbitrary precision decimal type)
It might help to find if it was the actual query or the de-serialization that was the bottleneck.
I'm wondering if there are any plans to support Postgres versions 15 and 16?