OSDN Git Service

Add file headers.
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Fri, 3 Apr 2015 05:13:01 +0000 (14:13 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Fri, 3 Apr 2015 07:59:23 +0000 (16:59 +0900)
As the preparation for publication, added headers to every source
files.

Makefile
pg_store_plans--1.0.sql
pg_store_plans.c
pgsp_explain.c
pgsp_explain.h
pgsp_json.c
pgsp_json.h
pgsp_json_int.h
pgsp_json_text.c
pgsp_json_text.h

index e36782b..8623441 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# contrib/pg_stat_plan/Makefile
+# pg_stat_plan/Makefile
 
 MODULE_big = pg_store_plans
 OBJS = pg_store_plans.o pgsp_json.o pgsp_json_text.o pgsp_explain.o
index c632ca3..aba7f96 100644 (file)
@@ -1,7 +1,7 @@
-/* contrib/pg_stat_statements/pg_stat_statements--1.1.sql */
+/* pg_store_plans/pg_store_plans--1.0.sql */
 
 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
-\echo Use "CREATE EXTENSION pg_stat_statements" to load this file. \quit
+\echo Use "CREATE EXTENSION pg_store_plans" to load this file. \quit
 
 -- Register functions.
 CREATE FUNCTION pg_store_plans_reset()
index 606c57c..a22085f 100644 (file)
@@ -1,11 +1,32 @@
 /*-------------------------------------------------------------------------
  *
- * pg_store_plans
+ * pg_store_plans.c
+ *             Take statistics of plan selection across a whole database cluster.
+ *
+ * Execution costs are totalled for each distinct plan for each query,
+ * and plan and queryid are kept in a shared hashtable, each record in
+ * which is associated with a record in pg_stat_statements, if any, by
+ * the queryid.
+ *
+ * For Postgres 9.3 or earlier does not expose query id so
+ * pg_store_plans needs to calculate it based on the given query
+ * string using different algorithm from pg_stat_statements, and later
+ * the id will be matched against the one made from query string
+ * stored in pg_stat_statsments. For the reason, queryid matching in
+ * this way will fail if the query string kept in pg_stat_statements
+ * is truncated in the middle.
+ *
+ * Plans are identified by fingerprinting plan representations in
+ * "shortened" JSON format with constants and unstable values such as
+ * rows, width, loops ignored. Nevertheless, stored plan entries hold
+ * them of the lastest execution. Entry eviction is done in the same
+ * way to pg_stat_statments.
  *
  * Copyright (c) 2008-2013, PostgreSQL Global Development Group
+ * Copyright (c) 2012-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
  *
  * IDENTIFICATION
- *       contrib/pg_store_plan/pg_store_plan.c
+ *       pg_store_plan/pg_store_plan.c
  *
  *-------------------------------------------------------------------------
  */
index d7f3d99..9489bb2 100644 (file)
@@ -1,5 +1,14 @@
-/*
- * pgsp_explain: extracted code from explain.c for explain of triggers.
+/*-------------------------------------------------------------------------
+ *
+ * pgsp_explain.c: extracted code from explain.c for explain of triggers.
+ *
+ * Copyright (c) 2008-2013, PostgreSQL Global Development Group
+ * Copyright (c) 2012-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ *
+ * IDENTIFICATION
+ *       pg_store_plan/pgsp_explain.c
+ *
+ *-------------------------------------------------------------------------
  */
 
 #include "postgres.h"
index 3e63301..027cc22 100644 (file)
@@ -1,3 +1,16 @@
+/*-------------------------------------------------------------------------
+ *
+ * pgsp_explain.h: extracted code from explain.c for explain of triggers.
+ *
+ * Copyright (c) 2008-2013, PostgreSQL Global Development Group
+ * Copyright (c) 2012-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ *
+ * IDENTIFICATION
+ *       pg_store_plan/pgsp_explain.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
 void pgspExplainTriggers(ExplainState *es, QueryDesc *queryDesc);
 
 /* ExplainInitState() is replaced with NewExlainState() in 9.5 */
index 9e606d7..c09b2b1 100644 (file)
@@ -1,3 +1,15 @@
+/*-------------------------------------------------------------------------
+ *
+ * pgsp_json.c: Plan handler for JSON/XML/YAML style plans
+ *
+ * Copyright (c) 2012-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ *
+ * IDENTIFICATION
+ *       pg_store_plan/pgsp_json.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
 #include "postgres.h"
 #include "miscadmin.h"
 #include "nodes/nodes.h"
index 0bd044f..a086f18 100644 (file)
@@ -1,3 +1,15 @@
+/*-------------------------------------------------------------------------
+ *
+ * pgsp_json.h: Definitions of plan handler for JSON/XML/YAML style plans
+ *
+ * Copyright (c) 2012-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ *
+ * IDENTIFICATION
+ *       pg_store_plan/pgsp_json.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
 #include "pgsp_json_text.h"
 
 extern char *pgsp_json_normalize(char *json);
index 24b94ec..eeaa0af 100644 (file)
@@ -1,3 +1,15 @@
+/*-------------------------------------------------------------------------
+ *
+ * pgsp_json_int.h: Definitions for internal use for pgsp_json.c
+ *
+ * Copyright (c) 2012-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ *
+ * IDENTIFICATION
+ *       pg_store_plan/pgsp_json_int.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
 typedef enum
 {
        PGSP_JSON_SHORTEN,
index d9edc7f..8cdfe78 100644 (file)
@@ -1,3 +1,15 @@
+/*-------------------------------------------------------------------------
+ *
+ * pgsp_json_text.h: Text plan generator for pg_store_plan.
+ *
+ * Copyright (c) 2012-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ *
+ * IDENTIFICATION
+ *       pg_store_plan/pgsp_json_text.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
 #include "postgres.h"
 #include "miscadmin.h"
 #include "nodes/nodes.h"
index 5c7fe39..8f59e98 100644 (file)
@@ -1,3 +1,15 @@
+/*-------------------------------------------------------------------------
+ *
+ * pgsp_json_text.h: Defenitions for text plan generator for pg_store_plan.
+ *
+ * Copyright (c) 2012-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ *
+ * IDENTIFICATION
+ *       pg_store_plan/pgsp_json_text.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
 typedef struct
 {
        NodeTag nodetag;