Skip to content

SQLx is significantly slower than postgres / tokio-postgres #2436

@Mivik

Description

@Mivik

Bug Description

I've been using sqlx for a long time until recently I discovered its performance is really, really bad. I did a benchmark on my laptop and it yielded a ridiculous 150x speed difference with regards to tokio-postgres.

Benchmark code

Benchmark result

Things I've tried:

  • Using a single connection instead of connection pool: That sped up around 2x, but a 70x difference still exists.
  • Using sqlx::query!: Nothing changed.
  • Enabling / disabling TLS: Nothing changed.

Info

  • SQLx version: 0.6.3
  • SQLx features enabled: ["runtime-tokio-native-tls", "postgres", "time", "chrono"]
  • Database server and version: Postgres 15.2 (Ubuntu 15.2-1.pgdg22.04+1)
  • Operating system: Ubuntu 22.04.2 LTS
  • rustc --version: rustc 1.68.0 (2c8cc3432 2023-03-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions