summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlvaro Herrera2020-01-15 14:02:09 +0000
committerAlvaro Herrera2020-01-15 14:14:39 +0000
commita166d408eb0b35023c169e765f4664c3b114b52e (patch)
tree1c432fec482f436cb6611988bff055ff5e27015d /src/include
parent16a4a3d59cd5574fdc697ea16ef5692ce34c54d5 (diff)
Report progress of ANALYZE commands
This uses the progress reporting infrastructure added by c16dc1aca5e0, adding support for ANALYZE. Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Co-authored-by: Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp> Reviewed-by: Julien Rouhaud, Robert Haas, Anthony Nowocien, Kyotaro Horiguchi, Vignesh C, Amit Langote
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h2
-rw-r--r--src/include/commands/progress.h17
-rw-r--r--src/include/pgstat.h1
-rw-r--r--src/include/utils/sampling.h4
4 files changed, 21 insertions, 3 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 40c1e8e0b85..6ac57be6a08 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202001091
+#define CATALOG_VERSION_NO 202001151
#endif
diff --git a/src/include/commands/progress.h b/src/include/commands/progress.h
index 3f91b3bf525..12e9d3d42f8 100644
--- a/src/include/commands/progress.h
+++ b/src/include/commands/progress.h
@@ -34,6 +34,23 @@
#define PROGRESS_VACUUM_PHASE_TRUNCATE 5
#define PROGRESS_VACUUM_PHASE_FINAL_CLEANUP 6
+/* Progress parameters for analyze */
+#define PROGRESS_ANALYZE_PHASE 0
+#define PROGRESS_ANALYZE_BLOCKS_TOTAL 1
+#define PROGRESS_ANALYZE_BLOCKS_DONE 2
+#define PROGRESS_ANALYZE_EXT_STATS_TOTAL 3
+#define PROGRESS_ANALYZE_EXT_STATS_COMPUTED 4
+#define PROGRESS_ANALYZE_CHILD_TABLES_TOTAL 5
+#define PROGRESS_ANALYZE_CHILD_TABLES_DONE 6
+#define PROGRESS_ANALYZE_CURRENT_CHILD_TABLE_RELID 7
+
+/* Phases of analyze (as advertised via PROGRESS_ANALYZE_PHASE) */
+#define PROGRESS_ANALYZE_PHASE_ACQUIRE_SAMPLE_ROWS 1
+#define PROGRESS_ANALYZE_PHASE_ACQUIRE_SAMPLE_ROWS_INH 2
+#define PROGRESS_ANALYZE_PHASE_COMPUTE_STATS 3
+#define PROGRESS_ANALYZE_PHASE_COMPUTE_EXT_STATS 4
+#define PROGRESS_ANALYZE_PHASE_FINALIZE_ANALYZE 5
+
/* Progress parameters for cluster */
#define PROGRESS_CLUSTER_COMMAND 0
#define PROGRESS_CLUSTER_PHASE 1
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index e5a5d025ba6..36b530bc27f 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -956,6 +956,7 @@ typedef enum ProgressCommandType
{
PROGRESS_COMMAND_INVALID,
PROGRESS_COMMAND_VACUUM,
+ PROGRESS_COMMAND_ANALYZE,
PROGRESS_COMMAND_CLUSTER,
PROGRESS_COMMAND_CREATE_INDEX
} ProgressCommandType;
diff --git a/src/include/utils/sampling.h b/src/include/utils/sampling.h
index a84914b968a..74646846b20 100644
--- a/src/include/utils/sampling.h
+++ b/src/include/utils/sampling.h
@@ -37,8 +37,8 @@ typedef struct
typedef BlockSamplerData *BlockSampler;
-extern void BlockSampler_Init(BlockSampler bs, BlockNumber nblocks,
- int samplesize, long randseed);
+extern BlockNumber BlockSampler_Init(BlockSampler bs, BlockNumber nblocks,
+ int samplesize, long randseed);
extern bool BlockSampler_HasMore(BlockSampler bs);
extern BlockNumber BlockSampler_Next(BlockSampler bs);