Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

Labeling Queries

To quickly identify queries for profiling and debugging purposes, include the LABEL hint. Later you can search the QUERY_REQUESTS and QUERY_PROFILES systems table for the label!

Example:

dbadmin=> CREATE TABLE big_table_test AS /*+ LABEL(big_table_test_label) */ SELECT * FROM big_table;
CREATE TABLE

dbadmin=> SELECT request FROM query_requests WHERE request_label = 'big_table_test_label';
                                                        request
-----------------------------------------------------------------------------------------------------------------------
CREATE TABLE big_table_test AS /*+ LABEL(big_table_test_label) */ SELECT * FROM big_table;
INSERT INTO public.big_table_test SELECT big_table.c1, big_table.c2, big_table.c3, big_table.c4 FROM public.big_table
(2 rows)

dbadmin=> SELECT query FROM query_profiles WHERE identifier = 'big_table_test_label';
                                                         query
-----------------------------------------------------------------------------------------------------------------------
CREATE TABLE big_table_test AS /*+ LABEL(big_table_test_label) */ SELECT * FROM big_table;
INSERT INTO public.big_table_test SELECT big_table.c1, big_table.c2, big_table.c3, big_table.c4 FROM public.big_table
(2 rows)

Helpful Links:
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/AdministratorsGuide/Profiling/LabelQueries.htm
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/Statements/CREATETABLE.htm

Have fun!

Sign In or Register to comment.

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.