Something lightweight and fast? Please no SQLx or Diesel.
Just to clear up some confusion, sqlx is not an orm.
May I ask what's stopping you from using SQLx? You can simply refrain from performing any object relational mapping. The library is perfectly built for executing your own SQL commands directly to the database of your choice asynchronously, with a runtime such as Tokio: By enabling the
runtime-tokio feature flag for SQLx.
If you are looking for a fast SQL library you should really consider using plain diesel, as it's currently the most performant solution according to the linked set of benchmarks. In an async context you are OK with using diesel through an async connection pool like
deadpool-diesel, as your are usually restricted on the number of database connections anyway. (That solution seems to be ~20% more performant that sqlx as shown by that post). If you believe for whatever reason that you need a fully async solution you can use
While diesel provides some ORM like features, you don't need to use them.
Could you explain the async solution in
deadpool-async vs the "fully" async solution provided by
diesel-async? I understand
deadpool-async provides pooling through
deadpool which is async but what exactly is the difference?
@feelingsonice You might be interested in the benchmark results and how
diesel_async compares to
deadpool-diesel provides an async pool implementation but uses sync diesel internally. It offers an API that enforces that your database queries run in a
spawn_blocking task and it internally uses essentially an async mutex to protext the pool on checkout/checkin.
diesel-async is a from scratch rust implementation that provides a completly async rust database driver for postgresql and mysql, compared to the "normal" libpq/libmysqlclient based drives used by "normal" diesel. (There is also support for
diesel-async, which then does not use
spawn_blocking as that's not required anymore)