plannertime.txt
text/plain
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 8b4d94c9a1..437256a35f 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -21,6 +21,7 @@
#include <fcntl.h>
#include <limits.h>
+#include <time.h>
#include <signal.h>
#include <unistd.h>
#include <sys/socket.h>
@@ -965,7 +966,15 @@ pg_plan_queries(List *querytrees, int cursorOptions, ParamListInfo boundParams)
}
else
{
+ clock_t start, end;
+
+ start = clock();
+
stmt = pg_plan_query(query, cursorOptions, boundParams);
+
+ end = clock();
+
+ elog(LOG, "PlannerTime: %f", (double)(end - start) / CLOCKS_PER_SEC);
}
stmt_list = lappend(stmt_list, stmt);