morphismtech / squeal

Squeal, a deep embedding of SQL in Haskell
353 stars 32 forks source link

Consider using postgresql-wire instead of postgresql-libpq #63

Open chshersh opened 6 years ago

chshersh commented 6 years ago

postgresql-wire implements native PostgreSQL driver which is much better for performance and GC.

echatav commented 6 years ago

Does postgres-wire provide a similar interface to postgresql-libpq? I'd need things like the Result type and exec, execParams, execPrepared, and prepare functions. Would you want to see it replace postgresql-binary as well? It looks like it has a bunch of codec logic. Squeal cannot depend on a library that's not on Shtackage but if it gets theres and is a good replacement, native Haskell has many advantages over C.

chshersh commented 6 years ago

Putting postgresql-wire on Stackage shouldn't be a problem. But, unfortunately, it's not even on Hackage which is a problem...

Regarding the rest: I'm not an expert in postgres-wire library, but I would like to have high level interface on top of the efficient backend.

Maybe @VyacheslavHashov or @qnikst can clarify things.

qnikst commented 6 years ago

I think it may be a bit of premature, at the current stage we will be working to wrapping everything up on the library level itself and try writing adapters for other libraries, then we can come with best practices and suggestions how higher-level libraries may try to use it. As far as I understand postgresql-simple design in concentrated around synchronous text protocol, so it may be very hard to write a compatible adapter to allow drop-in replacement. In the next few weeks, we will try to get more understanding of those questions and I'll get back to this thread.

reygoch commented 6 years ago

@ChShersh @qnikst Hasql might be a better option since it's on Hackage and Stackage and it is a native driver.

qnikst commented 6 years ago

@reygoch it's not entirely correct. hasql at least version on hackage is not a native driver, it's using libpg but the binary protocol. Despite the fact that hasql is a very nice library it inherits all the problems coming from libpg.

reygoch commented 6 years ago

@qnikst sorry, forgot to mention that author uses a bit convoluted versioning system. You want to look at v0.20.1. It is quite nice and soon to be released.

There is also a nice talk by the author explaining the functionality of the library.

This part of the talk might interest you in particular (11:18).

ilyakooo0 commented 5 years ago

@echatav https://mail.haskell.org/pipermail/haskell-cafe/2019-October/131609.html