Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdcad794

Browse files
committed
Change "query:" to "statement:".
Have log_duration print when log_min_duration_statement prints.
1 parent6acca57 commitdcad794

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.371 2003/10/08 03:49:37 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.372 2003/10/09 02:40:18 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -461,7 +461,7 @@ pg_parse_query(const char *query_string)
461461

462462
if (log_statement)
463463
ereport(LOG,
464-
(errmsg("query: %s",query_string)));
464+
(errmsg("statement: %s",query_string)));
465465

466466
if (log_parser_stats)
467467
ResetUsage();
@@ -943,7 +943,6 @@ exec_simple_query(const char *query_string)
943943
if (save_log_duration||save_log_min_duration_statement!=-1)
944944
{
945945
longusecs;
946-
boolprint_statement;
947946

948947
gettimeofday(&stop_t,NULL);
949948
if (stop_t.tv_usec<start_t.tv_usec)
@@ -953,22 +952,26 @@ exec_simple_query(const char *query_string)
953952
}
954953
usecs= (long) (stop_t.tv_sec-start_t.tv_sec)*1000000+ (long) (stop_t.tv_usec-start_t.tv_usec);
955954

955+
if (save_log_duration)
956+
ereport(LOG,
957+
(errmsg("duration: %ld.%03ld ms",
958+
(long) ((stop_t.tv_sec-start_t.tv_sec)*1000+
959+
(stop_t.tv_usec-start_t.tv_usec) /1000),
960+
(long) (stop_t.tv_usec-start_t.tv_usec) %1000)));
961+
956962
/*
957963
* Output a duration_statement to the log if the query has exceeded
958964
* the min duration, or if we are to print all durations.
959965
*/
960-
print_statement= (save_log_min_duration_statement==0||
961-
(save_log_min_duration_statement>0&&
962-
usecs >=save_log_min_duration_statement*1000));
963-
964-
if (save_log_duration||print_statement)
966+
if (save_log_min_duration_statement==0||
967+
(save_log_min_duration_statement>0&&
968+
usecs >=save_log_min_duration_statement*1000))
965969
ereport(LOG,
966-
(errmsg("duration: %ld.%03ld ms%s%s",
970+
(errmsg("duration: %ld.%03ld ms statement:%s",
967971
(long) ((stop_t.tv_sec-start_t.tv_sec)*1000+
968972
(stop_t.tv_usec-start_t.tv_usec) /1000),
969973
(long) (stop_t.tv_usec-start_t.tv_usec) %1000,
970-
print_statement ?" query: " :"",
971-
print_statement ?query_string :"")));
974+
query_string)));
972975
}
973976

974977
if (save_log_statement_stats)
@@ -2657,7 +2660,7 @@ PostgresMain(int argc, char *argv[], const char *username)
26572660
if (!IsUnderPostmaster)
26582661
{
26592662
puts("\nPOSTGRES backend interactive interface ");
2660-
puts("$Revision: 1.371 $ $Date: 2003/10/08 03:49:37 $\n");
2663+
puts("$Revision: 1.372 $ $Date: 2003/10/09 02:40:18 $\n");
26612664
}
26622665

26632666
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp