Shortcuts for Running SQL Commands and Scripts

For more information about the individual SQL scripts relevant to administration and to troubleshooting or performance tuning, see Tools.

After logging in to a console window and invoking:

source /opt/lce/tools/

A reminder banner will appear:

USAGE of the enabled shortcuts:


psqlc "<a SQL command>"


psqlf <path to script with SQL commands> [<arg1> [<arg2> [...]]]




Invokes interactive prompt. Note that you can also invoke SQL scripts

from within the interactive prompt, like so: \i <path to script>


; you will then be prompted for script args.


You can use the psqlf shortcut to run the various SQL scripts packaged with LCE that are found under /opt/lce/tools/pg-helper-sql/.

Here is an example of running a SQL script that takes no arguments:

psqlf pg-helper-sql/recent-alerts-24hours.sql

And here is an example of running a SQL script that takes an argument:

psqlf pg-helper-sql/disk-usage-one-silo.sql 0

To quickly locate and run a script:

  1. Log in to LCE via the command line interface (CLI).

  2. Type psqlf followed by a space.

  3. Type the first few letters of the name of the script you want to run. For example, to run wal-activity.sql, you can type wa.

  4. Press Tab.

    psqlf automatically completes the name of the script.

  5. To run the script, press Enter.

    LCE runs the selected script.