Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Terminal

Tianyi Chen edited this page Mar 29, 2018 · 16 revisions

Introduction

Peloton's interactive terminal allows you to interactively enter, edit, and execute SQL commands. It is very similar to the psql program in Postgres.

Start Peloton

Launch the peloton binary (which should be accessible on your PATH)

peloton

The default port number is 15721. You could also launch Peloton on a custom port as follows

peloton -port 5432

Access using PSQL

PSQL is the standard PostgreSQL client. Peloton has been tested to work with psql version 9.5.4.

To connect PSQL to Peloton running on your localhost as the database is "default_database", run

psql -U postgres -h localhost -p 15721 default_database

The default database is the only database when Peloton initially boots up.

If Peloton is running on non-default host or port or database, run

psql -h <peloton_host> -p <peloton_port> <database_name>

The latest versions of PSQL clients use SSL encryption to communicate with Postgres servers. It is necessary to disable this feature as Peloton doesn't support SSL-encypted communication yet.

Once PSQL connects successfully you will observe this familiar SQL client interface.

psql (9.5devel)
Type "help" for help.


postgres=# create table foo(id integer, year integer);
create table foo(id integer, year integer) 0

postgres=# insert into foo values(5, 400);
insert into foo values(5, 400) 1

postgres=# select * from foo;
 id | year 
----+------
  5 |  400
(1 row)

Load in a SQL script and run it using psql

psql (9.5devel)
Type "help" for help.

postgres=# \i ../scripts/testing/join/nested_loop_join.sql 

More info on the terminal

PSQL manual
PSQL common usage

Clone this wiki locally