One option is to use the standard Express.js logging mechanism:
DEBUG='sequelize:sql:*' npm run dev
npm run devs
These logs also include some kind of timing information. However, we are not entirely sure that the timings mean, as they show for both
Executing(query is about to start) and
Executed(query finished) lines with possibly different values e.g.:
The meaning of
sequelize:sql:pg Executing (default): SELECT 1+1 AS result +0ms sequelize:sql:pg Executed (default): SELECT 1+1 AS result +1ms
+1msappears to be the timing since last the last message with the same ID, i.e.
sequelize:sql:pgin this case. Therefore, so long as there wasn't any
sequelize:sql:pgbetween and the corresponding
Executingtiming should give us the query time.
This is a bit messy however, as we often want to find the largest numbers for profiling, and there could be a large time delta during inactivity.