This topic describes how to create, edit, delete, copy, and rename SQL queries in HoloWeb. The SQL window is designed for interactive, short queries. It is not suitable for offline job scenarios, such as importing or exporting large volumes of data. SQL statements that run for more than 60 minutes are not supported.
Prerequisites
You have logged on to a Hologres instance. For more information, see Log on to an instance.
Access the SQL editor
Log on to the Hologres console.
In the top navigation bar, select a region.
In the left navigation pane, click Go to HoloWeb.
In the top menu bar of HoloWeb, click .
Create a script
Procedure:
In the left Query panel, right-click My SQL query and select Create SQL Query.
Alternatively, click the
icon at the top of the Query panel to create a temporary script. After execution, click Save to save the content of the current SQL editor.In the Create SQL Query dialog box, configure the following parameters.
Parameter
Description
Job Name
The name of the SQL query.
Directory
The folder where the new SQL query is stored.
The default folder is My SQL query. You can also store the query in a new folder.
New Folder
The folder where the new SQL query is stored. You can choose to store the query in a new folder.
Instance Name
Select your Hologres instance.
Database Name
Select your database.
Click OK.
You can use PL/pgSQL for development in the SQL editor.
NoteTable names and field names in SQL queries are not case-sensitive. To perform a case-sensitive query on a table name, enclose the name in double quotation marks ("").
Area
Description
①
Displays the instance name, instance ID, database, current virtual warehouse, and current time zone for the SQL query.
②
Saves the content in the current SQL editor.
Refreshes the SQL editor.
③
All table information in the current destination database:
④
Run: Executes the SQL query.
Execution Plan: View execution plans.
Analyze: View the analysis.
Stop: Stops the execution.
Format: Formats the SQL command(s).
Document Settings: Supports setting the editor, parameters, and time zone.
More: Supports importing or exporting SQL, or going to DataWorks DataService Studio for SQL development.
⑤
: Searches runtime logs.
: Closes all logs, jumps to the last page of logs, or displays logs.
: Saves the logs.
: Pauses log scrolling.
and
: Expands or collapses the log display area.
NoteIn HoloWeb, SQL queries have a maximum execution time of 60 minutes. If a query exceeds this duration, it will be cancelled with a timeout error, indicating:
cancel query due to timeout, queryTimeout setting is: 3600s.Setting the
statement_timeoutparameter to a value greater than 60 minutes will not extend this maximum SQL execution time. For more information, see Modify the timeout period for an active query.
Manage an existing script
Navigate to the SQL Editor page as described in Access the SQL editor.
In the Query pane on the left, click My SQL query and find the target script. Perform the following operations:
NoteIf the target SQL script is in a folder, search it by name in the search box under Query.
Edit a script: Double-click the script to edit it in the SQL editor.
Delete a script: Right-click the SQL query and click Delete SQL Query Task.
Copy a script: Right-click the SQL query and click Copy SQL Query Task. You can then paste the copied SQL statements into another SQL query window.
Rename a script: Right-click the SQL query and click Rename. You can then enter a new name for the SQL query.