Queries can be created in the TD Console through the query editor in Data Workbench using the Presto or Hive query engines.
In the TD Console, click on the Data Workbench icon.
Click Queries and you are taken to the query editor. You can see a list of previous queries and when they were run. This list is useful if you want to edit or rerun a specific query.
You can also use the Queries page to create a new query.
- Click New Query on the top right of the TD Console to open the query editor.
After you have opened the query editor, you will see that you have two options for querying the data—Presto and Hive, depending on the use case, the size and type of the query, you will choose which query engine to use.
Presto is better for ad hoc and shorter batch workloads. Presto provides low-latency SQL access to the data set.
Hive is better for large or complex batch workloads. Hive is a MapReduce-based SQL engine. This engine is really powerful when you do large data processing and heavy JOINs. Often used for ETL or sessionization.
- Select the appropriate query engine option in the drop down menu.
- Select the database you want to query.
- Select the tables from which you want to query.
- Specify if you would like to run it on a regular recurring schedule or just once.
- Create your specific query using the appropriate SQL syntax for Presto or Hive.
You may preview any table under Table Preview.
- Click Save if you want to run it at a later date or click Run if you want to run it immediately.
- After the query has run, you see the results under Query Result. You now have the option to Copy or Download the results.
In the query editor, you also have the option to Export Results to various analytics tools. You can also see the history of the query under Run History.