src/bin/pgbench/pgbench.c:756-762
The ParsedScript structure represents a complete, parsed pgbench script containing all its commands, metadata, and execution statistics for weighted script selection and performance tracking.
typedef struct ParsedScript
{
const char *desc; /* script descriptor (eg, file name) */
int weight; /* selection weight */
Command **commands; /* NULL-terminated array of Commands */
StatsData stats; /* total time spent in script */
} ParsedScript;This structure encapsulates a complete pgbench script after parsing, providing a container for all commands within the script along with metadata for script identification and selection. The structure supports pgbench's weighted script selection feature, allowing multiple scripts to be executed with different probabilities based on their assigned weights. It also maintains comprehensive performance statistics for the entire script execution.
desc: Human-readable script descriptor, typically the file name or identifier, used for logging and error reportingweight: Numerical weight value used in weighted random selection when multiple scripts are available (higher weights increase selection probability)commands: NULL-terminated array of pointers to Command structures representing all commands in the script in execution orderstats: StatsData structure containing cumulative performance statistics and execution metrics for the entire script
- Functions called/Symbols referenced:
- Called from (representative examples):
ParsedScript serves as the primary container for script execution in pgbench, supporting both single-script and multi-script benchmark scenarios. The weight mechanism enables sophisticated workload modeling where different transaction patterns can be executed with controlled frequency distributions. The structure maintains script-level statistics that can be aggregated for comprehensive performance analysis across different script types within a single benchmark run.