Roy*_*y G 2 mysql orm sequelize.js
如何计算查询 Seqilize ORM 的执行时间?
小智 5
像这样打印查询插入的执行时间logging和benchmark选项:
const game = await Game.findAll({
    benchmark: true,
    logging: console.log,
    <...>
}
小智 5
如果您想记录由sequelize运行的所有查询的执行时间,您可能需要全局配置:
const sequelize = new Sequelize({
  benchmark: true,  // <-- this one enables tracking execution time
  logging: (sql: string, timingMs?: number) => logger.info(`${sql} - [Execution time: ${timingMs}ms]`),
  <...>
});