Run the Same Query Over and Over Again in vsql

Posted March 28, 2019 by James Knicely, Vertica Field Chief Technologist

The \g vsql meta-function sends the query in the input buffer to the server. This is great for interactively testing if a previous query run time was a fluke, and you don’t feel like typing in a long SQL statement again.

Example: dbadmin=> \timing on Timing is on. dbadmin=> SELECT * FROM dual; dummy ------- X (1 row) Time: First fetch (1 row): 16.268 ms. All rows formatted: 16.326 ms dbadmin=> \g dummy ------- X (1 row) Time: First fetch (1 row): 7.293 ms. All rows formatted: 7.331 ms dbadmin=> \g dummy ------- X (1 row) Time: First fetch (1 row): 5.320 ms. All rows formatted: 5.385 ms Helpful Link: https://www.vertica.com/docs/latest/HTML/Content/Authoring/ConnectingToVertica/vsql/Meta-Commands/MetaCommandReference.htm

Have fun!