Setting a client connection label
A client connection label identifies a connection to the database with a user-defined string. You can view the label for an existing session with GET_CLIENT_LABEL:
=> SELECT GET_CLIENT_LABEL();
GET_CLIENT_LABEL
----------------------------
my_client_connection_label
(1 row)
New connections
In JDBC, ODBC, and ADO.NET, you use each client driver's "Label" connection property to set the client label before connecting to the database. Setting the label before you connect ensures that the connection is associated with the label in all system and Data collector tables. Examples of these tables include SESSIONS and DC_SESSION_STARTS.
You can also preemptively set the client label with vsql by using the --label
option. For details, see -g --label
Existing connections
You can set a client connection label after you connect to a Vertica database with SET_CLIENT_LABEL:
=> SELECT SET_CLIENT_LABEL('py_data_load_application');
SET_CLIENT_LABEL
----------------------------------------------
client_label set to py_data_load_application
(1 row)
=> SELECT GET_CLIENT_LABEL();
GET_CLIENT_LABEL
--------------------------
py_data_load_application
(1 row)
Certain client drivers, like JDBC, have dedicated functions for setting the client connection label for existing connections. For details, see Setting and returning a client connection label.