xSQL Commands

In addition to executing SQL statements interactively, xSQL accepts a number of specific commands that can be entered at the XSQL> prompt. The SDK Samples provide many examples of command usage. The following table lists the xSQL commands with links providing additional explanation and/or examples:

dumplog <file-path>

Dump xSQL logs on the server side (See Logging Statistics)

xlog [bynode | byquery] [all]

Show server's logs (See Logging Statistics)

cluster

Cluster related commands (See Cluster Control)

ha getmode

Display the current HA role of the xSQL instance (See Miscellaneous Commands)

sleep <N>

Sleep for N seconds (See Miscellaneous Commands)

shutdown

Shutdown the database server

save <file-path>

Save database image to specified file (See Data Export and Import)

saveclass <file-path> <table-name>

Save table content to the specified file (See Data Export and Import)

loadclass <file-path> [ <table-name> ]

Load table content from the specified file (See Data Export and Import)

savemeta <file-path>

Save database metadata to specified file (See Data Export and Import)

savedict <file-path>

Save database dictionary to specified file (See Data Export and Import)

detach

Do not close database on exit (leave it in shared memory)

backup <database-file-path> <log-file-path> <n-threads=1>

Incremental backup of disk database to the specified files (See Data Export and Import)

mem [-b | -k | -m | -g | -t | -p]

Show memory usage in bytes (-b), Kb (-k, default), Mb (-m), Gb (-g), Tb (-t) or memory pages (-p)

memddl

Show dictionary memory usage

exit

Terminate interactive SQL session (See Tutorial Step 1)

pause

Pause interactive SQL session

trace (on | off)

Toggle query execution trace (See Logging Statistics)

progress (on | off)

Show progress of query execution

input (<file> | console)

Redirect input from specified file

script <file-path>

Execute SQL script from specified file (See Tutorial Step 2)

output [<file> | console | null]

Redirect output to specified file

logsession (on|off) [<file>]

Save session to specified file (See Logging Statistics)

format (TEXT | HTML | XML | CSV [delimiter 'C'] [header on | off] | LIST)

Select query output format (See Tutorial Step 3)

dtformat FORMAT

Output date / time format (see strftime) (See Tutorial Step 3)

numformat FORMAT

Output real number format (see sprintf) (See Tutorial Step 3)

strformat width=<N>

Set width for string fields (See Tutorial Step 3)

seqformat {default | short | long} [<first> <last>]

Output sequences format (See Tutorial Step 3)

arrayformat {default | short | long} [<first> <last>]

Output arrays format (See Tutorial Step 3)

nullformat NULLSTR

String representation for null values

help

Print supported commands

echo

Print arguments

import TABLE CSV-FILE [(use | skip) header] [commit N]

Import data from CSV file (See Data Export and Import)

filebackup dbFile logFile [nThreads]

Perform a file backup for a persistent database