$ npm i egg-sequelize-slow --save
// {app_root}/config/plugin.js
exports.sequelizeSlow = {
enable: true,
package: 'egg-sequelize-slow'
};
// {app_root}/config/config.default.js
exports.sequelizeSlow = {
logging: null // default
};
see config/config.default.js for more detail.
It will print SQL that the runtime is more than 1s to the terminal.
config.sequelizeSlow = {
logging: (ctx, sql, time, opts) => {
if (time > 1000) {
console.log(`# slow SQL: runtime:${time} =>`)
console.log(sql)
console.log(`# end`)
}
}
}
Please open an issue here.