Checking if a Query is Routed to Analytical Views

The EXPLAIN command allows you to check if the user query is being routed to an analytical view.

On the command line, issue the EXPLAIN command:

[localhost:21050] > explain select distinct(a) from foo;

A sample output looks something like this. Note that it indicates that a match has been found, and how the re-write of the query looks.

+--------------------------------------------------------------+
| Explain String                                               |
+--------------------------------------------------------------+
| REWR :                                                       |
| SELECT DISTINCT a '(a)' FROM default.av_foo av_foo           |
|                                                              |
| Estimated Per-Host Requirements: Memory=256.00MB VCores=2    |
| WARNING: The following tables are missing relevant table and |
| /or column statistics.                                       |
| default.av_foo                                               |
|                                                              |
| 04:EXCHANGE [PARTITION=UNPARTITIONED]                        |
| |                                                            |
| 03:AGGREGATE [MERGE FINALIZE]                                |
| |  group by: a                                               |
| |                                                            |
| 02:EXCHANGE [PARTITION=HASH(a)]                              |
| |                                                            |
| 01:AGGREGATE                                                 |
| |  group by: a                                               |
| |  num_threads: 11                                           |
| |                                                            |
| 00:SCAN HDFS [default.av_foo]                                |
|    partitions=2/2 size=750B                                  |
+--------------------------------------------------------------+

Next, let's discuss best practices and recommendations for analytical views.