MCPcopy Create free account
hub / github.com/apache/cloudberry / initCreateTables

Function initCreateTables

src/bin/pgbench/pgbench.c:4056–4152  ·  view source on GitHub ↗

* Create pgbench's standard tables */

Source from the content-addressed store, hash-verified

4054 * Create pgbench's standard tables
4055 */
4056static void
4057initCreateTables(PGconn *con)
4058{
4059 /*
4060 * Note: TPC-B requires at least 100 bytes per row, and the "filler"
4061 * fields in these table declarations were intended to comply with that.
4062 * The pgbench_accounts table complies with that because the "filler"
4063 * column is set to blank-padded empty string. But for all other tables
4064 * the columns default to NULL and so don't actually take any space. We
4065 * could fix that by giving them non-null default values. However, that
4066 * would completely break comparability of pgbench results with prior
4067 * versions. Since pgbench has never pretended to be fully TPC-B compliant
4068 * anyway, we stick with the historical behavior.
4069 */
4070 struct ddlinfo
4071 {
4072 const char *table; /* table name */
4073 const char *smcols; /* column decls if accountIDs are 32 bits */
4074 const char *bigcols; /* column decls if accountIDs are 64 bits */
4075 int declare_fillfactor;
4076 char *distributed_col;
4077 };
4078 static const struct ddlinfo DDLs[] = {
4079 {
4080 "pgbench_history",
4081 "tid int,bid int,aid int,delta int,mtime timestamp,filler char(22)",
4082 "tid int,bid int,aid bigint,delta int,mtime timestamp,filler char(22)",
4083 0
4084 , "bid"
4085 },
4086 {
4087 "pgbench_tellers",
4088 "tid int not null,bid int,tbalance int,filler char(84)",
4089 "tid int not null,bid int,tbalance int,filler char(84)",
4090 1,
4091 "tid"
4092 },
4093 {
4094 "pgbench_accounts",
4095 "aid int not null,bid int,abalance int,filler char(84)",
4096 "aid bigint not null,bid int,abalance int,filler char(84)",
4097 1
4098 , "aid"
4099 },
4100 {
4101 "pgbench_branches",
4102 "bid int not null,bbalance int,filler char(88)",
4103 "bid int not null,bbalance int,filler char(88)",
4104 1
4105 , "bid"
4106 }
4107 };
4108 int i;
4109 PQExpBufferData query;
4110
4111 fprintf(stderr, "creating tables...\n");
4112
4113 initPQExpBuffer(&query);

Callers 1

runInitStepsFunction · 0.85

Calls 8

initPQExpBufferFunction · 0.85
printfPQExpBufferFunction · 0.85
appendPQExpBufferFunction · 0.85
PQescapeIdentifierFunction · 0.85
PQfreememFunction · 0.85
executeStatementFunction · 0.85
termPQExpBufferFunction · 0.85
createPartitionsFunction · 0.85

Tested by

no test coverage detected