Node-mysql2: Reason to switch from other library

Created on 9 Dec 2019  路  5Comments  路  Source: sidorares/node-mysql2

I know the teams are working together as per README but is there any good reason why i should switch from mysqljs/mysql to use this module instead?

question

All 5 comments

I'm obviously biased, but for most users there are 2 important features that mysqljs/mysql lacks but this module provides: server side prepared statements and bundled promise wrapper ( you can easily have promise support using 3rd party modules with mysqljs/mysql as well)

There are other small differences here in there, for example adding custom auth plugin would be much easier here I guess. Performance might be better as well with mysql2 but please decide using your own benchmarks ( if mysql2 happen to be slower or take more memory please report, I'm happy to investigate )

As far as I can tell, prepared statements are also part of mysqljs/mysql. Promise wrapper is a big plus.

As far as I can tell, prepared statements are also part of mysqljs/mysql

No, not yet - https://github.com/mysqljs/mysql/issues/274

i see. Awesome thanks

I use this module because I need to be able to retrieve results in array format using rowsAsArray, and to stream rows back into the DB using LOAD DATA + custom streams.

I work with large CSV datasets, and rowsAsArray gives a very large performance increase when retrieving results for my workload. Also, streaming rows to LOAD DATA saves a ton of memory when loading gigantic CSV files into the DB and keeps memory from spiking during data loads which lets us pack more containers into each physical host. I can read multi-GB files out of storage and into the DB using barely any memory on the host.

Was this page helpful?
0 / 5 - 0 ratings