* Fill the standard tables with some data generated on the server * * As already the case with the client-side data generation, the filler * column defaults to NULL in pgbench_branches and pgbench_tellers, * and is a blank-padded string in pgbench_accounts. */
| 4307 | * and is a blank-padded string in pgbench_accounts. |
| 4308 | */ |
| 4309 | static void |
| 4310 | initGenerateDataServerSide(PGconn *con) |
| 4311 | { |
| 4312 | PQExpBufferData sql; |
| 4313 | |
| 4314 | fprintf(stderr, "generating data (server-side)...\n"); |
| 4315 | |
| 4316 | /* |
| 4317 | * we do all of this in one transaction to enable the backend's |
| 4318 | * data-loading optimizations |
| 4319 | */ |
| 4320 | executeStatement(con, "begin"); |
| 4321 | |
| 4322 | /* truncate away any old data */ |
| 4323 | initTruncateTables(con); |
| 4324 | |
| 4325 | initPQExpBuffer(&sql); |
| 4326 | |
| 4327 | printfPQExpBuffer(&sql, |
| 4328 | "insert into pgbench_branches(bid,bbalance) " |
| 4329 | "select bid, 0 " |
| 4330 | "from generate_series(1, %d) as bid", nbranches * scale); |
| 4331 | executeStatement(con, sql.data); |
| 4332 | |
| 4333 | printfPQExpBuffer(&sql, |
| 4334 | "insert into pgbench_tellers(tid,bid,tbalance) " |
| 4335 | "select tid, (tid - 1) / %d + 1, 0 " |
| 4336 | "from generate_series(1, %d) as tid", ntellers, ntellers * scale); |
| 4337 | executeStatement(con, sql.data); |
| 4338 | |
| 4339 | printfPQExpBuffer(&sql, |
| 4340 | "insert into pgbench_accounts(aid,bid,abalance,filler) " |
| 4341 | "select aid, (aid - 1) / %d + 1, 0, '' " |
| 4342 | "from generate_series(1, " INT64_FORMAT ") as aid", |
| 4343 | naccounts, (int64) naccounts * scale); |
| 4344 | executeStatement(con, sql.data); |
| 4345 | |
| 4346 | termPQExpBuffer(&sql); |
| 4347 | |
| 4348 | executeStatement(con, "commit"); |
| 4349 | } |
| 4350 | |
| 4351 | /* |
| 4352 | * Invoke vacuum on the standard tables |
no test coverage detected