squeal icon indicating copy to clipboard operation
squeal copied to clipboard

Consider using postgresql-wire instead of postgresql-libpq

Open chshersh opened this issue 7 years ago • 7 comments

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

  • https://github.com/postgres-haskell/postgres-wire

chshersh avatar Sep 21 '18 08:09 chshersh

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.

echatav avatar Sep 21 '18 10:09 echatav

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.

chshersh avatar Sep 21 '18 10:09 chshersh

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.

qnikst avatar Sep 21 '18 11:09 qnikst

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

reygoch avatar Oct 12 '18 21:10 reygoch

@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.

qnikst avatar Oct 13 '18 19:10 qnikst

@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).

reygoch avatar Oct 13 '18 20:10 reygoch

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

ilyakooo0 avatar Oct 24 '19 11:10 ilyakooo0