mirror of
https://github.com/postgres/postgres.git
synced 2025-12-01 12:18:01 +03:00
Add a few more DTrace probes to the backend.
Robert Lor
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.554 2008/07/18 20:26:06 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.555 2008/08/01 13:16:09 alvherre Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@@ -50,6 +50,8 @@
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/print.h"
|
||||
#include "optimizer/planner.h"
|
||||
#include "pgstat.h"
|
||||
#include "pg_trace.h"
|
||||
#include "parser/analyze.h"
|
||||
#include "parser/parser.h"
|
||||
#include "postmaster/autovacuum.h"
|
||||
@@ -70,7 +72,6 @@
|
||||
#include "utils/snapmgr.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
|
||||
#include "pgstat.h"
|
||||
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
@@ -551,6 +552,8 @@ pg_parse_query(const char *query_string)
|
||||
{
|
||||
List *raw_parsetree_list;
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_PARSE_START(query_string);
|
||||
|
||||
if (log_parser_stats)
|
||||
ResetUsage();
|
||||
|
||||
@@ -572,6 +575,8 @@ pg_parse_query(const char *query_string)
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
|
||||
|
||||
return raw_parsetree_list;
|
||||
}
|
||||
|
||||
@@ -591,6 +596,8 @@ pg_analyze_and_rewrite(Node *parsetree, const char *query_string,
|
||||
Query *query;
|
||||
List *querytree_list;
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_REWRITE_START(query_string);
|
||||
|
||||
/*
|
||||
* (1) Perform parse analysis.
|
||||
*/
|
||||
@@ -607,6 +614,8 @@ pg_analyze_and_rewrite(Node *parsetree, const char *query_string,
|
||||
*/
|
||||
querytree_list = pg_rewrite_query(query);
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_REWRITE_DONE(query_string);
|
||||
|
||||
return querytree_list;
|
||||
}
|
||||
|
||||
@@ -677,6 +686,8 @@ pg_plan_query(Query *querytree, int cursorOptions, ParamListInfo boundParams)
|
||||
if (querytree->commandType == CMD_UTILITY)
|
||||
return NULL;
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_PLAN_START();
|
||||
|
||||
if (log_planner_stats)
|
||||
ResetUsage();
|
||||
|
||||
@@ -711,6 +722,8 @@ pg_plan_query(Query *querytree, int cursorOptions, ParamListInfo boundParams)
|
||||
if (Debug_print_plan)
|
||||
elog_node_display(DEBUG1, "plan", plan, Debug_pretty_print);
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_PLAN_DONE();
|
||||
|
||||
return plan;
|
||||
}
|
||||
|
||||
@@ -785,6 +798,7 @@ exec_simple_query(const char *query_string)
|
||||
bool isTopLevel;
|
||||
char msec_str[32];
|
||||
|
||||
|
||||
/*
|
||||
* Report query to various monitoring facilities.
|
||||
*/
|
||||
@@ -792,6 +806,8 @@ exec_simple_query(const char *query_string)
|
||||
|
||||
pgstat_report_activity(query_string);
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_START(query_string);
|
||||
|
||||
/*
|
||||
* We use save_log_statement_stats so ShowUsage doesn't report incorrect
|
||||
* results because ResetUsage wasn't called.
|
||||
@@ -1058,6 +1074,8 @@ exec_simple_query(const char *query_string)
|
||||
if (save_log_statement_stats)
|
||||
ShowUsage("QUERY STATISTICS");
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_DONE(query_string);
|
||||
|
||||
debug_query_string = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.123 2008/05/12 20:02:02 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.124 2008/08/01 13:16:09 alvherre Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "commands/prepare.h"
|
||||
#include "commands/trigger.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pg_trace.h"
|
||||
#include "tcop/pquery.h"
|
||||
#include "tcop/tcopprot.h"
|
||||
#include "tcop/utility.h"
|
||||
@@ -711,6 +712,8 @@ PortalRun(Portal portal, long count, bool isTopLevel,
|
||||
|
||||
AssertArg(PortalIsValid(portal));
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_EXECUTE_START();
|
||||
|
||||
/* Initialize completion tag to empty string */
|
||||
if (completionTag)
|
||||
completionTag[0] = '\0';
|
||||
@@ -857,6 +860,8 @@ PortalRun(Portal portal, long count, bool isTopLevel,
|
||||
|
||||
if (log_executor_stats && portal->strategy != PORTAL_MULTI_QUERY)
|
||||
ShowUsage("EXECUTOR STATISTICS");
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_EXECUTE_DONE();
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1237,6 +1242,8 @@ PortalRunMulti(Portal portal, bool isTopLevel,
|
||||
*/
|
||||
PlannedStmt *pstmt = (PlannedStmt *) stmt;
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_EXECUTE_START();
|
||||
|
||||
if (log_executor_stats)
|
||||
ResetUsage();
|
||||
|
||||
@@ -1257,6 +1264,8 @@ PortalRunMulti(Portal portal, bool isTopLevel,
|
||||
|
||||
if (log_executor_stats)
|
||||
ShowUsage("EXECUTOR STATISTICS");
|
||||
|
||||
TRACE_POSTGRESQL_QUERY_EXECUTE_DONE();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user