From c77d27b515ed0a5d88bf427c6bb457cc36b702a7 Mon Sep 17 00:00:00 2001 From: zhangjintao Date: Fri, 10 Feb 2023 22:48:41 -0800 Subject: [PATCH] =?UTF-8?q?gsql=20=E5=AE=A2=E6=88=B7=E7=AB=AF\timing=20?= =?UTF-8?q?=E8=AE=A1=E6=97=B6=E5=BC=80=E5=85=B3=E6=89=93=E5=BC=80=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E6=97=B6=E9=97=B4=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/psql/common.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bin/psql/common.cpp b/src/bin/psql/common.cpp index f8e3222a8..872826f37 100644 --- a/src/bin/psql/common.cpp +++ b/src/bin/psql/common.cpp @@ -1226,6 +1226,12 @@ bool SendQuery(const char* query, bool is_print, bool print_error) else if (!PQsendQuery(pset.db, query)) results = NULL; + if (pset.timing && is_print) { + INSTR_TIME_SET_CURRENT(after); + INSTR_TIME_SUBTRACT(after, before); + elapsed_msec = INSTR_TIME_GET_MILLISEC(after); + } + OK = GetPrintResult(&results, is_explain, is_print, query, print_error); #ifndef WIN32 /* Clear password related memory to avoid leaks when core. */ @@ -1237,11 +1243,6 @@ bool SendQuery(const char* query, bool is_print, bool print_error) } #endif - if (pset.timing && is_print) { - INSTR_TIME_SET_CURRENT(after); - INSTR_TIME_SUBTRACT(after, before); - elapsed_msec = INSTR_TIME_GET_MILLISEC(after); - } // For EXPLAIN PERFORMANCE command, the query is sent by PQsendQuery. // But PQsendQuery doesn't wait for it to finish and then goes to the do-while