I did some testing with Nim a couple of years ago for HashBackup. Here's one of the db_sqlite issues I created:
https://github.com/nim-lang/Nim/issues/13559
I had much better luck with tiny_sqlite: https://github.com/GULPF/tiny_sqlite
It seems that issue is now fixed. Either way, Nexus will soon support multiple DB drivers, and I'll work on making adding new ones relatively straightforward.
Re:Mastering Nim – now available on Amazon
by rishav_sharan on Thursday June 30, 2022 @06:14AM
(#31930568)
I went with db_postgres as well. Unfortunately, it is not async. I did consider treeform's pg, but unfortunately i did not get any reply from him on my question so decided not to go with it for the TE benchmarks.
I think the lowest hanging fruit for db drivers would be to just wrap libpq, the default PG driver. Given Nim's c interop, that should be easy. I was planning to do that, but then life happened and I had to skip that project.
I would say, that if you are trying to create a very involved framework, you should look to solve this problem. Otherwise the current perf of db_postgres can be a big deterrent to a lot of potential users.
I agree that wrapping libpq sounds like a good idea.
Re:Mastering Nim – now available on Amazon
by rishav_sharan on Friday July 01, 2022 @06:37AM
(#31944587)
did a bit more digging and apparantly db_postgres wraps libpq already. So either nim is still using a very old version of libpq or it was never updated to use the async apis.
Actual work on DB drivers is out-of-scope for me though. I noticed there is an async Postgres driver available: https://github.com/treeform/pg. I don't know how well tested this driver is, and no mention of pipelining support.
It would be great to see Nim's web frameworks higher up on the Techempower benchmarks. Lack of such DB driver features usually comes down to time. The support for those features in stdlib would be a good bounty issue.