-
Notifications
You must be signed in to change notification settings - Fork 623
Terminal
Pelonton's interactive terminal allows you to interactively enter, edit, and execute SQL commands. It is very similar to the psql
program in Postgres.
Here is a shell script that you can use to bootstrap peloton easily.
Here are the steps you need to follow to get access to a terminal :
cd build
initdb ./data
We use initdb
to create a new database cluster which is a collection of databases that are managed by a single Peloton server instance. Here, ./data
is the location of the data directory for this new database cluster. All the tables and indices in any database that is part of this cluster will be stored in this directory.
pg_ctl -D ./data start
pg_ctl
is a program that can be used to start, stop, and control a Peloton server. It is installed along with Peloton, by default in usr/local/peloton/bin
. Here, we use it to start the server.
createuser -s -r postgres
We need to create a default user using createuser
utility. This can be used to add more users as well. We can also create a new database foo
like this.
createdb foo
psql postgres
help
Finally, we can connect to the Peloton server using the psql
terminal utility. Here, we connect to the postgres
database. We can also connect to any other database in the cluster by altering this command. To get a list of psql
shortcuts, just type help
and then press enter.
pg_ctl -D ./data stop
Now, we can use pg_ctl
to stop the server.
psql (9.5devel)
Type "help" for help.
parallels=# \i ../scripts/testing/join/nested_loop_join.sql