Help Center> Database and Application Migration UGO> FAQs> Migration Project> Why Is Data Inconsistent When SELECT Statements Without ORDER BY Are Used for Query in Distributed GaussDB?
Updated on 2024-03-08 GMT+08:00

Why Is Data Inconsistent When SELECT Statements Without ORDER BY Are Used for Query in Distributed GaussDB?

Symptom

Figure 1 There is no ORDER BY in SELECT statements.

Causes

In distributed GaussDB, data is evenly stored on each DN based on distribution keys. If ORDER BY is not specified in a SELECT query, data is randomly read from DNs. Therefore, data consistency cannot be ensured.

Solution

Use ORDER BY in SQL statements for query. The column followed by ORDER BY is the distribution key.

Figure 2 SELECT statements with ORDER BY

Migration Project FAQs

more