Run the Same Query Over and Over Again in VSQL

Jim_KnicelyJim_Knicely - Select Field - Administrator

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/9.2.x/HTML/Content/Authoring/ConnectingToVertica/vsql/Meta-Commands/MetaCommandReference.htm

Have fun!

Sign In or Register to comment.