Sequelize querying a lot slower than Knex

I have the following code:

var apiLogger = require(__dirname + '/../configurations/logger').api;
var Knex = require('knex');
var microtime = require('microtime');
var Sequelize = require("sequelize");

database = new Sequelize('MYDATABASE', 'MYUSERNAME', 'MYPASSWORD', {
  host: "MYHOST",
  port: 3306,
  dialect: 'mysql',
  pool: {
    maxConnections: 5,
    maxIdleTime: 30
  }
});

Knex.Initialize({
  client: 'mysql',
  connection: {
    host     : 'MYHOST',
    user     : 'MYUSERNAME',
    password : 'MYPASSWORD',
    database : 'MYDATABASE',
    charset  : 'utf8'
  }
});

exports.test = function(req, res){
  apiLogger.info('Request made to /api/test');

  var start = microtime.nowDouble();
  database.query('SELECT id, username FROM Users ORDER BY RAND() LIMIT 10').then(function(data) {
    console.log('query time : ' + (microtime.nowDouble() - start));
    res.json(data);
  }, function(data) {
    res.json(data);
  });
};

exports.test2 = function(req, res){
  apiLogger.info('Request made to /api/test2');

  var start = microtime.nowDouble();
  Knex.Raw('SELECT id, username FROM Users ORDER BY RAND() LIMIT 10').then(function(data) {
    console.log('query time : ' + (microtime.nowDouble() - start));
    res.json(data);
  }, function(data) {
    res.json(data);
  });
};

If I execute the code in exports.test (an api call of /api/test) about 5 seconds apart from each other, the average response is about 430ms and this is the Sequelize code.

If I run the code from exports.test2 (and api call of /api/test2) 5 seconds apart, the first call is 430ms but the call after that are about 100ms and that is Knex.

I should mention if I run the exports.test code less than a second apart from each other, I get the about 100ms response time and with the exports.test2 code, I can wait 2-3 minutes between calls and still get the 100ms response time.

Is there some sort of configuration I am missing with Sequelize that is causing it to be much slower compared to Knex? Why would requests made minutes apart with Knex be much faster than the same request made seconds apart with Sequelize?

I set the default connection pool in Knex to a minimum of 10:

https://github.com/tgriesser/knex/blob/master/clients/base.js#L22

That might be the reason.

You can set the number of pooled connections with:

Knex.Initialize({
  client: 'mysql',
  connection: {
    host     : 'MYHOST',
    user     : 'MYUSERNAME',
    password : 'MYPASSWORD',
    database : 'MYDATABASE',
    charset  : 'utf8'
  },
  pool: {
    max: 5
  }
});