Skip to content

Proposal: Port persistent-mysql to use a pure haskell database driver. #659

@naushadh

Description

@naushadh

persistent-mysql uses mysql (via mysql-simple) as the database driver. mysql is a haskell FFI wrapper for mysqlclient written in C.

Reasons to use a pure haskell driver:

  • mysql has concurrency issues as noted by @feuerbach.
  • mysql-haskell, a pure haskell driver by @winterland1989, outperforms mysql-simple in benchmarks (see hackage or project repo).
  • better portability and possible static compilation of an entire project that uses persistent-mysql.

Personal experience on replacing mysql-simple with mysql-haskell in a project:

  • Performance gains consistent with benchmark.
  • Smoother deployment to Amazon EC2, since mysql appears to have a hard dependency on the oracle version of libmysqlclient that does not work with the open source variant that is available by default on EC2 (and possibly on other cloud providers).

Potential issues:

  • ConnectInfo and defaultConnectInfo are not the same between the packages, therefore the port will not be 100% backward compatible; i.e., even with a best effort wrapper type, mysql SSLInfo cannot be 1:1 mapped to mysql-haskell TLS ClientParams.
  • mysql-haskell does not allow provide an API for client options.

P.S. I've already got a couple of implementations in my fork:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions