Tuning tools postgresql comes in pgbehch
One.
pgbehch installation must be completed before you can use
1.pgbehch installation
1-1. The installation location of (A. Pg is installed, the data stored in the directory B. Analyzing may also be used ./pgbench --help)
find / -name pgbench
cd /data/postgresql-10.9/src/bin/pgbench
make all
make install
two. Novice know pgbehch
1. For many online said pgbehch command, for starters, often do not know where to perform, such as: To use the database initialization pgbehch: pgbench -i pgbench command
But I do not know where to perform ah, so, give the following explanation:
1-1.
Pgbench is a command, like psql, it is kind of tool command
1-2.
Since it is a tool command, you must first install the tool
1-3.
We typically perform psql command, if the command is not added to the path environment variable, it must perform directory corresponding to the next command, and start with ./
Summary: So the above explanation, already know where you want to execute the command
2. Know where command execution pgbehch, but we do not know how to perform, and what command execution
Such as: database initialization pgbehch
Myth:
first thought pgbehch to be executed in psql inside
, you want to connect to a specific database to perform,
no no no
! ! ! As long as the normal place of execution on the line, and
commands were executed pgbench -i pgbench
It can be understood: pgbench command have to begin with pgbench
pgbench -i pgbench means: initialize a database called the pgbench
So the premise that we must connect psql, create a database called the pgbench
3.
The pgbench added to the environment variable path in the pgbench command can be executed at any place
Pwd just a bit, in order to perform ./pgbench which, to be added to the path environment variable to the path
# End user postgres
exit
vi / etc / profile
# Pgbench path added to the environment variable path in
export PATH=$PATH:/data/postgresql-10.9/src/bin/psql:/data/postgresql-10.9/src/bin/pgbench
source /etc/profile
Results are as follows: