If the time zone of your instance is different from the time zone of your business, you must change the time zone of your instance to ensure the accuracy of time information during data processing and the consistency of the displayed time information across time zones.
Limits
The system allows you to change the time zone of your StarRocks instance only if the last three-digit version number of the minor version of the instance is greater than or equal to 1.6.0. For example, if the minor version of a StarRocks instance is 3.3.2-1.81-1.6.5, the last three-digit version number is 1.6.5, which is greater than 1.6.0. In this case, the system allows you to change the time zone of the instance.
Precautions
Before you import data, make sure that the global time zone of StarRocks is consistent with the time zone of deployed frontend (FE) nodes. Otherwise, an exception occurs when data of the DATE type is imported.
Introduction to time zones
The default value of the StarRocks time zone is Asia/Shanghai.
system_time_zone: the time zone of the operating system. It is the time zone of deployed FE nodes. You can change the time zone in the console.time_zone: the session-level or global time zone. You can execute an SQL statement to change the time zone.
Change the system time zone
If you change the system time zone, the StarRocks instance is restarted. Therefore, we recommend that you perform this operation during off-peak hours.
Go to the details page of an EMR Serverless StarRocks instance.
Log on to the EMR console.
In the left-side navigation pane, choose .
In the top navigation bar, select a region based on your business requirements.
In the Instances section, find the desired StarRocks instance and click the name of the instance.
-
On the Instance Details page, in the Basic Information section, click Modify Time Zone.
-
In the Modify Time Zone dialog box, configure the following parameters and click OK.
Parameter
Description
Select Time Zone
Select the desired time zone.
Restart Mode
This parameter is available only for shared-data instances.
You can select a rolling restart or a quick restart.
-
Rolling Restart (default): This mode restarts the compute nodes (CNs) in the instance one by one, ensuring that some nodes are always running to maintain service availability. Recommended for scenarios that require high service continuity and minimal user impact.
-
Quick Restart: This mode restarts all CNs at once for a faster restart process. However, this may cause a brief service interruption. Perform this operation during off-peak hours.
NoteA quick restart is supported only for shared-data instances with a minor version of 1.6.10 or later.
-
Execute an SQL statement to view the time zone
Connect to the instance. For more information, see Use EMR StarRocks Manager to connect to an EMR Serverless StarRocks instance.
-
Execute the following SQL statement to view the time zone configuration:
SHOW VARIABLES LIKE '%time_zone%';The following information is returned:
It lists all time zone-related variables, such as the system time zone and the current session or global time zone.
Variable_name: The name of the variable, such assystem_time_zoneandtime_zone.Value: The value of the variable. The value indicates the time zone, such asAsia/Shanghai.
Execute an SQL statement to specify the session-level or global time zone
You can configure the time_zone parameter in the SQL editor to specify the time zone of StarRocks, and specify whether the time zone configuration takes effect at the session level or globally.
If you want the time zone configuration to take effect at the session level, execute the
SET time_zone = 'xxx';SQL statement. Different time zones can be specified for different sessions. If you disconnect a client from an FE node, the time zone configuration becomes invalid.If you want the time zone configuration to take effect globally, execute the
SET global time_zone = 'xxx';SQL statement. An FE node stores the time zone configuration. The time zone configuration remains effective after you disconnect a client from the FE node.