fastify-mysql icon indicating copy to clipboard operation
fastify-mysql copied to clipboard

Using the mariadb-connector-nodejs client instead of mysql2

Open GiovanniSlabs opened this issue 1 year ago • 4 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

I wanted to suggest using the mariadb-connector-nodejs client as it claims to offer much higher performance compared to mysql2. I have used it in several projects with excellent results. However, I have never conducted independent benchmarks on the two clients.

Motivation

The motivation is to make everything as fast as possible. Following the philosophy of Fastify

Example

No response

GiovanniSlabs avatar Aug 03 '24 09:08 GiovanniSlabs

I'm afraid it mighht be a bit of a breaking change, as I expect the two modules to have different APIs.

mcollina avatar Aug 03 '24 17:08 mcollina

In this article (https://mariadb.com/resources/blog/which-node-js-connector-is-best-to-use/) where they do some benchmarking on the main MySQL clients for Node, they claim that mysql2 and mariadb share the same API as the mysql connector, which is why I suggested it.

GiovanniSlabs avatar Aug 04 '24 09:08 GiovanniSlabs

They say the client implementations are compatible, I think this could be very cool area to explore — it's quite a bit more performant

gurgunday avatar Aug 27 '24 07:08 gurgunday

+3 from my side. I would love to migrate to the faster mariadb package instead of mysql2.

Client implementations are indeed compatible, if that is really not the case. We could always create a separate Fastify plugin??

melroy89 avatar Nov 02 '25 21:11 melroy89