pgbench_vacuum_order_v1.patch

application/octet-stream

Filename: pgbench_vacuum_order_v1.patch
Type: application/octet-stream
Part: 0
Message: pgbench -i order of vacuum

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
Series: patch v1
File+
contrib/pgbench/pgbench.c 0 0
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
new file mode 100644
index 7aa4750..67ce7d0
*** a/contrib/pgbench/pgbench.c
--- b/contrib/pgbench/pgbench.c
*************** usage(void)
*** 372,378 ****
  		   "  -l           write transaction times to log file\n"
  		   "  -M simple|extended|prepared\n"
  		   "               protocol for submitting queries to server (default: simple)\n"
! 		   "  -n           do not run VACUUM before tests\n"
  		   "  -N           do not update tables \"pgbench_tellers\" and \"pgbench_branches\"\n"
  		   "  -r           report average latency per command\n"
  		   "  -s NUM       report this scale factor in output\n"
--- 372,378 ----
  		   "  -l           write transaction times to log file\n"
  		   "  -M simple|extended|prepared\n"
  		   "               protocol for submitting queries to server (default: simple)\n"
! 		   "  -n           do not run VACUUM before tests, (or after initialization if given with -i)\n"
  		   "  -N           do not update tables \"pgbench_tellers\" and \"pgbench_branches\"\n"
  		   "  -r           report average latency per command\n"
  		   "  -s NUM       report this scale factor in output\n"
*************** disconnect_all(CState *state, int length
*** 1290,1296 ****
  
  /* create tables and setup data */
  static void
! init(void)
  {
  	/*
  	 * Note: TPC-B requires at least 100 bytes per row, and the "filler"
--- 1290,1296 ----
  
  /* create tables and setup data */
  static void
! init(bool is_no_vacuum)
  {
  	/*
  	 * Note: TPC-B requires at least 100 bytes per row, and the "filler"
*************** init(void)
*** 1441,1446 ****
--- 1441,1455 ----
  	}
  	executeStatement(con, "commit");
  
+ 	/* vacuum */
+ 	if (!is_no_vacuum) {
+ 		fprintf(stderr, "vacuum...\n");
+ 		executeStatement(con, "vacuum analyze pgbench_branches");
+ 		executeStatement(con, "vacuum analyze pgbench_tellers");
+ 		executeStatement(con, "vacuum analyze pgbench_accounts");
+ 		executeStatement(con, "vacuum analyze pgbench_history");
+ 	}
+ 
  	/*
  	 * create indexes
  	 */
*************** init(void)
*** 1477,1488 ****
  		}
  	}
  
- 	/* vacuum */
- 	fprintf(stderr, "vacuum...");
- 	executeStatement(con, "vacuum analyze pgbench_branches");
- 	executeStatement(con, "vacuum analyze pgbench_tellers");
- 	executeStatement(con, "vacuum analyze pgbench_accounts");
- 	executeStatement(con, "vacuum analyze pgbench_history");
  
  	fprintf(stderr, "done.\n");
  	PQfinish(con);
--- 1486,1491 ----
*************** main(int argc, char **argv)
*** 2162,2168 ****
  
  	if (is_init_mode)
  	{
! 		init();
  		exit(0);
  	}
  
--- 2165,2171 ----
  
  	if (is_init_mode)
  	{
! 		init(is_no_vacuum);
  		exit(0);
  	}