Add slow_query_time to log only slow queries
parent
b98797ed49
commit
7529c6dcbe
|
@ -1,6 +1,6 @@
|
|||
// Простенький "селект билдер" по мотивам MediaWiki-овского, успешно юзаю подобный в PHP уже лет 8
|
||||
// (c) Виталий Филиппов, 2019-2020
|
||||
// Версия 2020-06-12
|
||||
// Версия 2020-11-17
|
||||
|
||||
// В PHP, правда, прикольнее - там в массиве можно смешивать строковые и численные ключи,
|
||||
// благодаря чему можно писать $where = [ 't1.a=t2.a', 't2.b' => [ 1, 2, 3 ] ]
|
||||
|
@ -748,7 +748,11 @@ class Connection extends ConnectionBase
|
|||
const r = await this.dbh.query(sql);
|
||||
if (this.config.log_queries)
|
||||
{
|
||||
console.log('> pid='+process.pid+' '+((Date.now()-start_time)/1000).toFixed(3)+' '+sql);
|
||||
const tm = (Date.now()-start_time)/1000;
|
||||
if (!this.config.slow_query_time || tm > this.config.slow_query_time)
|
||||
{
|
||||
console.log('> pid='+process.pid+' '+tm.toFixed(3)+' '+sql);
|
||||
}
|
||||
}
|
||||
if (this.in_transaction === true)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue