prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
15.78k stars 5.29k forks source link

Abnormal data display when using offset and limit #22883

Open wangmiao1002 opened 1 month ago

wangmiao1002 commented 1 month ago

Your Environment

select stat_dt, month, b_id, b_name, p_id, p_name, r_id, r_name, pl_id, pl_name, M4_bal, M5_bal, M5_bal, M5_bal, M6_al, M6_bal, M6_bal, M7_bal, M7_bal, M7_bal from rmk.bal_stat WHERE 1 = 1 and stat_dt = '2024-03-31' order by b_id, b_name, p_id, p_name, r_id, r_name, pl_id, desc offset 1000 limit 1000 When executing the above statement, it was found that the data returned each time was inconsistent. How can I avoid this?

tdcmeehan commented 1 month ago

If there are duplicates in the sorted columns, but more values in the columns which are not sorted, then this is possible. Can you try to add more columns to the sort clause?

wangmiao1002 commented 1 month ago

All fields in the table have been added to the sorting, but the data returned each time may still be inconsistent; Most field types are decimal (18,2), and there are also some bigint and varchar, but varchar is used to store Chinese characters