Working with Query Plans
Accessing Query Plans
There are three ways to see the query plans in the Web UI:
- In the SQL Editor of the Web UI, the query plan can be accessed by clicking on the Show Query Plan icon:
The query plan will be displayed for the query that currently contains the cursor. - It is also possible to investigate the query plan for the selected SQL if its text is marked before clicking “Show Query Plan”.
- Query plans are also visible in the “Show Query Plan” Tab of DV Studio by selecting a query and clicking “Show Query Plan”. Please note that the query plans are archived along with the queries, so even if you change a view, it will not affect the plans of former queries.
Reading Query Plans
A query plan is read from bottom to top. In most cases, the source access will happen first, along the path processing on the CData Virtuality side and enriching data, with a final query node on top of the plan, indicating the result is returned to the user.
Example:
One issue can be seen here: in the join nodes, type conversion is happening for the IDs. CData Virtuality automatically casts to the bigger data type to be able to perform a join on different data types. Depending on the situation, it might make sense to perform this cast manually in the query to make it more efficient.