summaryrefslogtreecommitdiff
path: root/contrib/pgbench/pgbench.c
Commit message (Collapse)AuthorAgeFilesLines
* pgindent run before PG 9.1 beta 1.Bruce Momjian2011-04-101-18/+18
|
* Stamp copyrights for year 2011.Bruce Momjian2011-01-011-1/+1
|
* Remove cvs keywords from all files.Magnus Hagander2010-09-201-1/+1
|
* Get rid of a bunch of dubious error handling code in pgbench by just erroringTom Lane2010-08-121-113/+94
| | | | | | out immediately on any out-of-memory condition. It's rather pointless to imagine that pgbench will be able to continue usefully after a malloc failure, and in any case there were a number of unchecked mallocs.
* Add the ability to compute per-statement latencies (ie, average executionTom Lane2010-08-121-53/+174
| | | | | | times) to pgbench. Florian Pflug, reviewed by Greg Smith
* pgindent run for 9.0, second runBruce Momjian2010-07-061-6/+6
|
* Each worker thread will have its own log file in pgbench to avoid interleavedItagaki Takahiro2010-03-231-30/+41
| | | | | | | writes. The first worker still uses "pgbench_log.<pid>" for the name, but additional workers use "pgbench_log.<pid>.<serial-number>" instead. Reported by Greg Smith.
* pgindent run for 9.0Bruce Momjian2010-02-261-92/+94
|
* Adjust headers to allow pgbench to be built with PGXS.Itagaki Takahiro2010-01-061-6/+3
|
* Add verification of variable names in pgbench.Itagaki Takahiro2010-01-061-23/+38
| | | | | | | | Variables must consist of only alphabets, numerals and underscores. We had allowed to set variables with invalid names, but could not refer them in queries. Thanks to Robert Haas for the review.
* Update copyright for the year 2010.Bruce Momjian2010-01-021-2/+2
|
* Add \shell and \setshell meta commands to pgbench.Itagaki Takahiro2009-12-151-5/+157
| | | | | | | | \shell command runs an external shell command. \setshell also does the same and sets the result to a variable. original patch by Michael Paquier with some editorialization by Itagaki, and reviewed by Greg Smith.
* Arrange to generate different random sequences in the different childTom Lane2009-12-111-4/+16
| | | | | | | | | | | | | | processes of a pgbench run, when we are using -j > 1 and are emulating threads via fork(). Otherwise the children all inherit the same random sequence state and produce the same random-number sequence. In the threaded case the different threads will share one RNG state, so they will produce different subsets of one sequence, which is maybe more correlated than a purist would like but will not be "the same". So we leave that case alone. First noticed by Takahiro Itagaki, and is also part of the explanation for the pgbench misbehavior recently reported by Jaime Casanova.
* pgbench has #defines for number of branches, tellers, and accounts. ThereTatsuo Ishii2009-09-101-9/+9
| | | | | | | | are used to populate the tables with -i, but when running actual benchmark it has values separately hard-coded in the query metacommands. This patch makes the metacommands obtain their values from the relevant #defines. Patch provided by Jeff Janes.
* Portability and documentation fixes for threaded pgbench patch.Tom Lane2009-08-031-16/+27
|
* Multi-threaded version of pgbench contributed by ITAGAKI Takahiro,Tatsuo Ishii2009-08-031-278/+510
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reviewed by Greg Smith and Josh Williams. Following is the proposal from ITAGAKI Takahiro: Pgbench is a famous tool to measure postgres performance, but nowadays it does not work well because it cannot use multiple CPUs. On the other hand, postgres server can use CPUs very well, so the bottle-neck of workload is *in pgbench*. Multi-threading would be a solution. The attached patch adds -j (number of jobs) option to pgbench. If the value N is greater than 1, pgbench runs with N threads. Connections are equally-divided into them (ex. -c64 -j4 => 4 threads with 16 connections each). It can run on POSIX platforms with pthread and on Windows with win32 threads. Here are results of multi-threaded pgbench runs on Fedora 11 with intel core i7 (8 logical cores = 4 physical cores * HT). -j8 (8 threads) was the best and the tps is 4.5 times of -j1, that is a traditional result. $ pgbench -i -s10 $ pgbench -n -S -c64 -j1 => tps = 11600.158593 $ pgbench -n -S -c64 -j2 => tps = 17947.100954 $ pgbench -n -S -c64 -j4 => tps = 26571.124001 $ pgbench -n -S -c64 -j8 => tps = 52725.470403 $ pgbench -n -S -c64 -j16 => tps = 38976.675319 $ pgbench -n -S -c64 -j32 => tps = 28998.499601 $ pgbench -n -S -c64 -j64 => tps = 26701.877815 Is it acceptable to use pthread in contrib module? If ok, I will add the patch to the next commitfest.
* Make sure FD_SETSIZE is set before we include any WindowsMagnus Hagander2009-07-301-3/+6
| | | | | | header files. Josh Williams
* 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian2009-06-111-69/+80
| | | | provided by Andrew.
* Change pgbench to use the table names pgbench_accounts, pgbench_branches,Tom Lane2009-05-071-53/+51
| | | | | | | | | | | pgbench_history, and pgbench_tellers, rather than just accounts, branches, history, and tellers. This is to prevent accidental conflicts with real application tables, as has been reported to happen at least once. Also remove the automatic "SET search_path = public" that it did at startup, as this seems to restrict testing flexibility without actually buying much. Per proposal by Joshua Drake and ensuing discussion. Joshua Drake and Tom Lane
* Equip the programs installed by contrib with proper --help and --versionPeter Eisentraut2009-02-271-7/+56
| | | | options and normally formatted help output.
* Remove feof(stdin) calls related to when to prompt for a password,Peter Eisentraut2009-02-251-3/+2
| | | | leftovers from when the password was read from stdin.
* Update copyright for 2009.Bruce Momjian2009-01-011-2/+2
|
* Add a duration option to pgbench, so that test length can be specified in ↵Tom Lane2008-09-111-9/+109
| | | | | | seconds instead of by number of transactions to run. Takahiro Itagaki
* Minor patch on pgbenchBruce Momjian2008-08-221-4/+6
| | | | | | | | | | 1. -i option should run vacuum analyze only on pgbench tables, not *all* tables in database. 2. pre-run cleanup step was DELETE FROM HISTORY then VACUUM HISTORY. This is just a slow version of TRUNCATE HISTORY. Simon Riggs
* Give a warning if -s switch is used with a non-custom pgbench test.Tom Lane2008-05-091-32/+21
| | | | | Also, clean up the code that assigned the scale into :scale variables. Greg Smith and Tom Lane
* Add -M (query mode) option per ITAGAKI TakahiroTatsuo Ishii2008-03-191-63/+238
|
* Fix tps calculation when -C supplied. Per Yoshiyuki Asaba.Tatsuo Ishii2008-03-191-31/+80
| | | | | Change Copyright owner from mine to PostgreSQL Global Development Group Fix minor message typo
* Add a comment explaining one of the ways that pgbench fails to fullyTom Lane2008-03-121-1/+11
| | | | comply with TPC-B. Per Itagaki Takahiro and discussion of bug#3681.
* Fix pgbench's getrand() function so that min and max have approximatelyTom Lane2008-03-101-3/+7
| | | | | the same chance of being selected as do numbers between them. Problem noted by Greg Stark; fix by Alexey Klyukin.
* Remove the -P options of oid2name and pgbench, as they are securityTom Lane2007-12-111-26/+40
| | | | | | | hazards. Instead teach these programs to prompt for a password when necessary, just like all our other programs. I did not bother to invent -W switches for them, since the return on investment seems so low.
* pgindent run for 8.3.Bruce Momjian2007-11-151-20/+21
|
* Increase FD_SETSIZE on Win32 to allow for more than 54 clients.Magnus Hagander2007-10-221-1/+3
| | | | Per Greg Stark & Dave Page
* Tweak pgbench.c to remove the hidden assumption that a WIN32 machineTom Lane2007-09-271-7/+3
| | | | | | | couldn't possibly HAVE_GETOPT. I believe this is the most appropriate form of the patch submitted 2007-08-07 by Hiroshi Saito, though not having a Windows build environment I won't know for sure till I see the buildfarm results.
* The upper limit for -c option of pgbench is now obtained fromTatsuo Ishii2007-08-251-2/+7
| | | | (FD_SETSIZE - 10) rather than a hardwired number.
* Fix possible core dump from pgbench -d option. Julius StroffekTom Lane2007-08-221-2/+2
|
* Fix possible portability problem, per buildfarm warnings.Tom Lane2007-07-151-2/+2
|
* Changed new \usleep command into \sleep with an optional time unitJan Wieck2007-07-061-4/+26
| | | | | | argument to specify us, ms or s. As per suggestion by Peter E. Jan
* Added a new scripting meta commandJan Wieck2007-07-061-5/+96
| | | | | | | | | \usleep [milliseconds|:variable] which can be used in -f scripts to insert a thinking time between other commands. Jan
* Avoid assuming that the fields of struct timeval have exactly type long.Tom Lane2007-05-241-2/+3
| | | | | This is probably incorrect on some platforms, and definitely draws a compiler warning on Darwin.
* Add -F option to set fillfactor for tellers, accounts and branches.Tatsuo Ishii2007-04-081-7/+36
| | | | | Patch contributed by Pavan Deolasee. Along with Japanese doc modification by Tatsuo Ishii.
* Enhance pgbench -l option to add timestamp. Patch contributed by GregTatsuo Ishii2007-04-061-2/+3
| | | | | | | | | | | | | | | | | | Smith. Along with Japanese doc updation by Tasuo Ishii. > This patch changes the way pgbench outputs its latency log files so that > every transaction gets a timestamp and notes which transaction type was > executed. It's a one-line change that just dumps some additional > information that was already sitting in that area of code. I also made a > couple of documentation corrections and clarifications on some of the more > confusing features of pgbench. > > It's straightforward to parse log files in this format to analyze what > happened during the test at a higher level than was possible with the > original format. You can find some rough sample code to convert this > latency format into CVS files and then into graphs at > http://www.westnet.com/~gsmith/content/postgresql/pgbench.htm which I'll > be expanding on once I get all my little patches sent in here.
* Various pgbench enhancements. Patch contributed by ITAGAKI Takahiro.Tatsuo Ishii2007-04-061-153/+67
| | | | | | | | | | | | | | | | | | | | | | | | Also tweak README.pgbench/README.pgbench_jis: Remove history after pgbench was added to PostgreSQL contrib module. Those info was not only redundant since it has already been in CVS log, but also incomplete. -------------------------------------------------------------------------- The attached is a patch to optimize contrib/pgbench using new 8.3 features. - Use DROP IF EXISTS to suppress errors for initial loadings. - Use a combination of TRUNCATE and COPY to reduce WAL on creating the accounts table. Also, there are some cosmetic changes. - Change the output of -v option from "starting full vacuum..." to "starting vacuum accounts..." in reflection of the fact. - Shape duplicated error checks into executeStatement(). There is a big performance win in "COPY with no WAL" feature. Thanks for the efforts! --------------------------------------------------------------------------
* Set stderr to unbuffered for pgbench on win32.Magnus Hagander2007-03-131-1/+6
| | | | ITAGAKI Takahiro
* Adjust pgbench so it won't spit up on non-select queries returningTom Lane2007-01-221-16/+17
| | | | | tuples, which is entirely possible with custom scripts (consider RETURNING, EXPLAIN, etc).
* Update copyright yearTatsuo Ishii2007-01-101-2/+2
|
* Call srandom() instead of srand().Tatsuo Ishii2006-12-261-2/+2
| | | | | | | pgbench calls random() later, so it should have called srandom(). On most platforms except Windows srandom() is actually identical to srand(), so the bug only bites Windows users. per bug report from Akio Ishida.
* pgbench: More fix with handling default scaling factor in the defaultTatsuo Ishii2006-10-211-1/+21
| | | | | | scenarios. With multiple clinets, only the first client got the right scaling factor and this gave a illusion of better performance in case of the scaling factor greater than 1.
* On platforms that have getrlimit(RLIMIT_STACK), use it to ensure thatTom Lane2006-10-071-9/+10
| | | | | | | | max_stack_depth is not set to an unsafe value. This commit also provides configure-time checking for <sys/resource.h>, and cleans up some perhaps-unportable code associated with use of that include file and getrlimit().
* pgindent run for 8.2.Bruce Momjian2006-10-041-9/+11
|
* Fix some more uses of str[n]casecmp that should be pg_str[n]casecmp.Tom Lane2006-09-161-6/+6
|