Skip to content

Commit 046cf93

Browse files
authored
QueryProfiler UI Doc (#1338)
* Create getting_started_qprof_ui.rst * Update getting_started_qprof_ui.rst * Update getting_started_qprof_ui.rst * added pics for the UI * Update getting_started_qprof_ui.rst
1 parent 0c73e18 commit 046cf93

File tree

20 files changed

+312
-0
lines changed

20 files changed

+312
-0
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
.. _verticapylab_gs.queryprofiler:
2+
3+
=============================
4+
Query Profiler User Interface
5+
=============================
6+
7+
Query Profiler provides a user-friendly way to analyze your queries and find improvement opportunities.
8+
Whether you are an expert or a beginner, it can offer you some good inisghts into your query.
9+
10+
To use this, you need:
11+
12+
1. VerticaPyLab
13+
2. Vertica database
14+
15+
To install and setup (1), please follow the instruction here: :ref:`verticapylab_gs`. This page also has instruction for the cases where you do not have a Vertica database and would like to try out the Vertica CE.
16+
17+
Now let us finally explain what the different UI functionalities are to this date i.e. 11/13/2024.
18+
19+
.. note:: The UI has been transforming based on user-feedback so some elements may have been moved around.
20+
21+
.. _main_page:
22+
23+
VerticaPyLab Main Page
24+
======================
25+
26+
When you start up the VerticaPyLab, you will be ending up on the launcher page. Here you can use to connect button to connect to your databse, or if you are connected, then directly click on the Query Profiler button.
27+
28+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/1.png
29+
:width: 90%
30+
:align: center
31+
32+
.. _qprof_main_page:
33+
34+
Query Profiler Page
35+
===================
36+
37+
Once you click on the Query Profiler button, you will be directed to the Query Profiler page.
38+
39+
The header of this page has the following elements:
40+
41+
- The home button: This will take you back to the main page: :ref:`main_page`.
42+
- The connect button: This will take you to the connect page.
43+
44+
45+
If you are connected to the database, you should be able to see your database and username under the connection details.
46+
47+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/2.png
48+
:width: 90%
49+
:align: center
50+
51+
52+
.. note:: If you need to learn more about the QueryProfiler tool, then you can click on the link at the right corner.
53+
54+
55+
You can use this page in three different ways:
56+
57+
1. To load an existing profile data that has been stored in a ``target schema`` with a specific ``key``.
58+
2. To run and profile a new query (or a list of queries) and, optionally, store it in a ``target schema`` with a specific ``key``.
59+
3. Compare two different queries by either retrieving the existing profile data stored in a ``target schema`` with a specific ``key`` or by running and profiling a new query.
60+
61+
Let's look at each of these use cases in the following sections.
62+
63+
Load Existing Profile Data
64+
---------------------------
65+
66+
In order to retrieve a saved profile data, you need to provide the ``key`` and ``target schema``. You have the option to enter it manually or use the dropdowns provided. Note that the ``target_schema`` you provide should already exist.
67+
68+
Once you have provided these, you can click on the ``Get Query Plan`` button to load the profile data into the UI.
69+
70+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/3.png
71+
:width: 90%
72+
:align: center
73+
74+
Additionally, there is an option to load the data from a ``tar file``. You can click on the ``From a file`` tabe and select the tar file. Don't forget to confirm the selection.
75+
76+
Once you have provided these, you can click on the ``Get Query Plan`` button to load the profile data into the UI.
77+
78+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/4.png
79+
:width: 90%
80+
:align: center
81+
82+
Creating a new Query Profile
83+
----------------------------
84+
85+
You can create a new query profile by using two methods:
86+
87+
1. By using the ``transaction_id`` and ``statement_id`` of the query. This means that the query should already have been run.
88+
89+
1. By using the SQL of the query.
90+
91+
.. note:: In all the options, the ``target_schema`` and ``key`` are optional. If you leave them empty then a temporary schema and key will be used which you may not be able to retrieve later.
92+
93+
You could search for a query using the search tab. Then you can extract the ``transaction_id`` and ``statement_id`` of the query and use them to create a new query profile. For the search you have the option to search using the custom label that the user has provided or the query text itself. You can search for exact match or partial match.
94+
95+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/5.png
96+
:width: 90%
97+
:align: center
98+
99+
To profile a query with transaction id and statement id, just enter the values in the provided text boxes and click on the ``Get Query Plan`` button.
100+
101+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/6.png
102+
:width: 90%
103+
:align: center
104+
105+
To profile the query using SQL, you can click the ``From SQL`` tab. In this tab, you can enter the SQL of the query and click on the ``Get Query Plan`` button. You can even enter multiple queries by separating them with a semicolon. For example:
106+
107+
.. code-block:: sql
108+
109+
select * from table1; select * from table2;
110+
111+
The last tab in this section is the ``Multiple Queries`` tab. Here you can enter a list of tuples of ``transaction_id`` and ``statement_id``. For example:
112+
113+
.. code-block:: Python
114+
115+
[(12345678,1), (23456789,1)]
116+
117+
Once you have provided these, you can click on the ``Get Query Plan`` button to load the profile data into the UI. Remember you can optionally provide the ``target_schema`` and ``key`` to store the profile data.
118+
119+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/7.png
120+
:width: 90%
121+
:align: center
122+
123+
Compare Queries
124+
---------------
125+
126+
You can provide information about two queries to compare them. This is done by either retrieving the existing profile data stored in a ``target schema`` with a specific ``key`` or by running and profiling a new query.
127+
128+
To retrieve the existing profile data stored in a ``target schema`` with a specific ``key``, just enter the ``target_schema`` and ``key`` and click on the ``Compare`` button.
129+
130+
To profile an unsaved query, you can either enter the ``transaction_id`` and ``statement_id`` of the query or use the SQL of the query.
131+
132+
Lastly, you have the optional to change ``SESSION PARAMETERS`` for your query. All you need to do is enter the session control SQL and click on the ``Compare`` button. for example:
133+
134+
.. code-block:: sql
135+
136+
ALTER SESSION SET statement_mem = 100000000;
137+
138+
139+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/8.png
140+
:width: 90%
141+
:align: center
142+
143+
144+
Query Plan Tree Page
145+
=====================
146+
147+
Once you have loaded the profile data, you can see the query plan in the Query Plan Tree page.
148+
149+
150+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/9.png
151+
:width: 90%
152+
:align: center
153+
154+
155+
Let's go over the different elements of the Query Plan Tree page:
156+
157+
Download tab
158+
------------
159+
160+
The ``Download`` tab. If you click the ``Save qprof Information & Report`` button, it will download the profile data as a tar file. And also save the profile report as an HTML file that can be viewed offline.
161+
162+
Query Plan Tree
163+
---------------
164+
165+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/10.png
166+
:width: 90%
167+
:align: center
168+
169+
The first you tab you notice here is the Query Plan Tree tab. It displays the query plan in a graphical tree format with color coding for different metrics of the query e.g. time, memory, cost, etc. There are different ettings that you can use to explore the query plan. They are listed below:
170+
171+
1. Metrics
172+
173+
Here you can change the metrics that you want to see by clicking on the ``Metrics`` tab. You can also select the tooltips that you want to see by checking the information that you want to be displayed.
174+
175+
176+
2. Path ID
177+
178+
In this tab you can filter the path ids that you are interested in. You can do this directly be selecting the particular ``path id`` from the dropdown menu. You can also search by tooltip by entering the part of tooltip that you want to match. This could be name of the table that you notice in the tooltip. You can also search by filtering operators. Use the dropdowns to select either one or two opeartors. For example, criterea 1 could be ``JOIN`` and criterea 2 could be ``SCAN``. To go back to the orginal tree, you can click on the ``Reset`` button.
179+
180+
3. Tree Style
181+
182+
The first option here is to choose between displaying ``Temporary Relations`` combined or separate. The next option is to toggle the display of ``DML Projections``
183+
184+
4. Query Text
185+
186+
Here you will see the query text of the query that you are currently looking at.
187+
188+
5. Session PARAMETERS
189+
190+
All the ``SESSION PARAMETERS`` that are non-default will be listed here.
191+
192+
6. Detailed tooltip
193+
194+
If you want to look deeper into the tooltip of a sepcific path id, you can select it from the dropdown menu.
195+
196+
7. Summary
197+
198+
The key elements of the query execution plan are listed here.
199+
200+
8. Navigation buttons
201+
202+
If you have multiple queries in your profile data, then you can use the navigation buttons to switch between the queries.
203+
204+
205+
Query Events Tab
206+
-----------------
207+
208+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/11.png
209+
:width: 90%
210+
:align: center
211+
212+
The ``Query Events`` tab displays the query events for the query that you are currently looking at.
213+
214+
You can select the query that you want to look it from the dropdown menu, and then click ``Run Statistics`` to get the statistics for the query.
215+
216+
.. note:: You can head over to the ``Transactions`` tab to get the exact query index of the query you want to run statistics for.
217+
218+
On the top it will display a summary in the form of a half-pie chart indicating the number of alerts for each category: ``OPTIMIZER``, ``NETWORK``, and ``EXECUTION``.
219+
220+
Below, all the events will be displayed. You can filter with ``Node``, ``Category``, and ``Type`` to find particular events.
221+
222+
Lastly, you can click on the ``Take Action`` button to resolve the action automatically.
223+
224+
.. warning:: This can have serious consequences on your data. So double the SQL that is about to be run.
225+
226+
Query Engines Tab
227+
-----------------
228+
229+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/12.png
230+
:width: 90%
231+
:align: center
232+
233+
In this tab, we display all the data from the ``QueryEngineExection`` table. We have two main types of display:
234+
235+
1. Summary
236+
237+
Here all the aggregates are displayed either node-wise or path_id-wise.
238+
239+
2. Detailed
240+
241+
Here the users have the option to look at either the raw table or a pivot table. For the pivot table, the users can select the specific metrics they want to see from the checklist on the right side.
242+
243+
Transactions Tab
244+
----------------
245+
246+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/13.png
247+
:width: 90%
248+
:align: center
249+
250+
In this tab, we display all the important information from the ``QueryRequest`` table.
251+
252+
Plots Tab
253+
---------
254+
255+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/14.png
256+
:width: 90%
257+
:align: center
258+
259+
.. warning:: This tab is still under development and may result in some issues.
260+
261+
262+
Other Info
263+
----------
264+
265+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/15.png
266+
:width: 90%
267+
:align: center
268+
269+
In this tab, we have two tables that display the ``Slow Events`` and ``Optimizer Events``. But we filter the information only for the specific query that is profiled.
270+
271+
Manual Query
272+
------------
273+
274+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/16.png
275+
:width: 90%
276+
:align: center
277+
278+
We allow the users to run SQL directly from this tab. This is useful if the user wants to run a query that is not part of the profile data.
279+
280+
Explain Plan
281+
------------
282+
283+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/17.png
284+
:width: 90%
285+
:align: center
286+
287+
We allow the users to run ``EXPLAIN PLAN`` directly from this tab. To get the desired results, you must be connected to your database that you ran the query on.
288+
289+
Advanced vDataFrame Output settings
290+
-------------------------------------
291+
292+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/18.png
293+
:width: 90%
294+
:align: center
295+
296+
The users can modify the ``vDataFrame`` display settings as per their desire. This mean that the users can change the ``display.max_rows`` or removing/inserting commas for numerical data.
297+
298+
299+
Consistency Checks
300+
------------------
301+
302+
.. image:: ../../docs/source/_static/website/getting_started/query_profiler_ui/19.png
303+
:width: 90%
304+
:align: center
305+
306+
Here we display the results of the consistency checks that we have run on the profile data. This tells us if some information in the tables were removed because of rentention issues.
307+
308+
Execution/Error Details
309+
------------------------
310+
311+
All the execution details and error details of the queries are displayed here. This is useful if you want to see the details of the execution and error of the query that you are currently looking at.
312+

0 commit comments

Comments
 (0)