What is Vsql - Introduction
- vsql is a character-based, interactive, front-end utility that lets you type SQL statements and see the results.
- It also provides a number of meta-commands and various shell-like features that facilitate writing scripts and automating a variety of tasks.
- We have two methods of using vsql:
- Administration Tools
- Linux command line
Following is how we login from command line.
<> /home/sukul1 $ export LANG=en_US.UTF-8
<> /home/sukul1 $ export PAGER=less
<> /home/sukul1 $ vsql -U sukul1 -w
diwali_2015# -h gone077.xxxx.lll.com
Welcome to vsql, the Vertica Analytic Database
interactive terminal.
Type: \h or \?
for help with vsql commands
\g or
terminate with semicolon to execute query
\q to
quit
Bad terminal type: "xterm". Will assume
vt100.
sukul1=>
- SQL statements can be spread over several lines for clarity.
sukul1=> select *
sukul1-> from
sukul1-> projections
sukul1-> ;
Note that SQL can be spread on multiple lines.
When SQL is continued on the multiple lines, the prompt
changes from => to ->.
- vsql can handles input and output in UTF-8 encoding. Note that the terminal emulator running vsql must be set up to display the UTF-8 characters correctly.
When using Putty we can change this setting at
"Change Settings > Window >
Translation"
- We can
cancel SQL statements using CTrl-C
Following is how the output looks like if we cancel the SQL
:Cancel request sent
ERROR 3322:
Execution canceled by operator
sukul1=>
- We can use the up and down keys to traverse the command history.
- When you disconnect a user session, any transactions in progress are automatically rolled back
- To
allow pagination of the results we should use linux less utility.
Before connecting to the database, we should specify that we want to use less for query output.
<> /home/sukul1 $ export PAGER=less
- If a shell running vsql fails (crashes or freezes), the vsql processes continue to run even if you stop the database. In that case, log in as root on the machine on which the shell was running and manually kill the vsql process.
No comments:
Post a Comment