Live data from Hacker News

A pure Go embedded SQL database

gitlab.com

21–30 of 51 posts

Re: A pure Go embedded SQL database

#21
post #17

Earlier quoted context omitted.

Yes. It doesn’t play nice with goroutines and Go’s concurrency model, from what I understand.

Yes, function calls across the boundary are slow. It's fine if the functions do lots of work, it's very expensive for function calls that should be cheap. For sqlite it might not matter too much, since any query does quite a bit of work.

A query may do a lot of work but iterating over many results could be very slow.

Re: A pure Go embedded SQL database

#23
post #9

Earlier quoted context omitted.

Well for one, if it's in Go, it wouldn't need Cgo.

The same author ("cznic") has also built a C-to-Go compiler/transpiler and used it to convert SQLite to pure Go source, so that it doesn't require CGo: https://gitlab.com/cznic/sqlite ... the converted Go code is pretty much unreadable and it's somewhat slower than SQLite via CGo. But a pretty neat idea! I use it in one of my projects and it works well.

Nice. I tried to cross-compile a Go app using SQLite for darwin/arm64 a couple months back and couldn’t figure it out for the life of me. Ended up just shipping a darwin/amd64 binary and letting Rosetta handle it. Will give this a spin when I have time.

Re: A pure Go embedded SQL database

#24
post #17

Earlier quoted context omitted.

Yes, function calls across the boundary are slow. It's fine if the functions do lots of work, it's very expensive for function calls that should be cheap. For sqlite it might not matter too much, since any query does quite a bit of work.

A query may do a lot of work but iterating over many results could be very slow.

Yes, the API is probably suboptimal for Go. It's better to make a wrapper that does the query and fetches many results in one call, into a Go buffer.

Re: A pure Go embedded SQL database

#26
The cardinal rule of databases: http://www.dbms2.com/2013/03/18/dbms-development-marklogic-h...

Ignoring that leads to long postmortems about how your embedded db failed in a way you didn’t expect: https://blog.roblox.com/2022/01/roblox-return-to-service-10-...

SQLite is good

Rocksdb is good

You don’t need pure go.

Re: A pure Go embedded SQL database

#27
post #23
post #9

Earlier quoted context omitted.

The same author ("cznic") has also built a C-to-Go compiler/transpiler and used it to convert SQLite to pure Go source, so that it doesn't require CGo: https://gitlab.com/cznic/sqlite ... the converted Go code is pretty much unreadable and it's somewhat slower than SQLite via CGo. But a pretty neat idea! I use it in one of my projects and it works well.

Nice. I tried to cross-compile a Go app using SQLite for darwin/arm64 a couple months back and couldn’t figure it out for the life of me. Ended up just shipping a darwin/amd64 binary and letting Rosetta handle it. Will give this a spin when I have time.

I should write a blog post this but here’s what I do in GitHub Actions for a Go binary that uses SQLite: https://github.com/crossjoin-io/crossjoin/blob/main/.github/...

Re: A pure Go embedded SQL database

#28
post #26

The cardinal rule of databases: http://www.dbms2.com/2013/03/18/dbms-development-marklogic-h... Ignoring that leads to long postmortems about how your embedded db failed in a way you didn’t expect: https://blog.roblox.com/2022/01/roblox-return-to-service-10-... SQLite is good Rocksdb is good You don’t need pure go.

How many tens of millions of dollars were ploughed into SQLite?

Re: A pure Go embedded SQL database

#30
post #26

The cardinal rule of databases: http://www.dbms2.com/2013/03/18/dbms-development-marklogic-h... Ignoring that leads to long postmortems about how your embedded db failed in a way you didn’t expect: https://blog.roblox.com/2022/01/roblox-return-to-service-10-... SQLite is good Rocksdb is good You don’t need pure go.

[deleted]
Post reply on HN