This tends to be a better good way for benchmarking than DEBUG sql:which sets in the Sequelize constructor:and produces many outputs of type:so we get explicit elapsed time measurements rather than deltas, and without the corresponding
OURBIGBOOK_LOG_DB=1 npm run dev
rew Sequelize({ logging: console.log })
Executed (default): SELECT 1+1 AS result Elapsed time: 0ms
Executing
marker.Furthermore, because we try to code the server correctly by making multiple
async
requests simultaneously wherever possible, the slowest of those requests finishes, last, and is the last "Elapsed time" to get logged! So you generally just have to look at the last logged line if there's one slow bottleneck query, rather than going over all the previous "Elapsed time" entries.This method uses Sequelize's
benchamrk: true
option as per: stackoverflow.com/questions/52260934/how-to-measure-query-execution-time-in-seqilize.