benchmark_list.txt

text/plain

Filename: benchmark_list.txt
Type: text/plain
Part: 0
Message: Re: POC: converting Lists into arrays
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 1bcfdd67e0..750320cb3b 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -22,6 +22,7 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <signal.h>
+#include <time.h>
 #include <unistd.h>
 #include <sys/socket.h>
 #ifdef HAVE_SYS_SELECT_H
@@ -965,9 +966,27 @@ pg_plan_queries(List *querytrees, int cursorOptions, ParamListInfo boundParams)
 		}
 		else
 		{
+			Query *q[10];
+			clock_t start, end;
+			int i;
+
+			for (i = 0; i < 10; i++)
+				q[i] = copyObject(query);
+
+			start = clock();
+
+			for (i = 0; i < 10; i++)
+				stmt = pg_plan_query(q[i], cursorOptions, boundParams);
+
+			end = clock();
+
+			elog(LOG, "PlannerTime: %f", (double)(end - start) / CLOCKS_PER_SEC / 10);
+
 			stmt = pg_plan_query(query, cursorOptions, boundParams);
 		}
 
+
+
 		stmt_list = lappend(stmt_list, stmt);
 	}